Commit c12f5411 authored by kiz_0987's avatar kiz_0987

#80537 and #70208 - Added access control to gallery.

It's almost all or nothing. Without access the user cannot see the gallery
or gallery blocks. However, embedded thumbnail images in nodes are still
visible (but the link won't work).
You also need to set 'mode.embed.only' to true in your Gallery2 config.php
file to avoid bypass via standalone.

IMPORTANT: You will need to set the user permissions to 'access gallery'
for the roles you want to be able to see the gallery.
parent a2e83850
......@@ -17,7 +17,7 @@ function gallery_menu($may_cache) {
'path' => 'gallery',
'title' => t('gallery'),
'callback' => 'gallery_page',
'access' => user_access('access content'),
'access' => user_access('access gallery'),
'type' => MENU_NORMAL_ITEM,
);
$items[] = array(
......@@ -151,7 +151,7 @@ function gallery_filter_tips($delta = 0, $format = -1, $long = false) {
* Implementation of hook_perm().
*/
function gallery_perm() {
return array('access standalone g2image');
return array('access gallery', 'access standalone g2image');
}
/**
......
......@@ -36,6 +36,9 @@ function _gallery_block($op = 'list', $delta = 0, $edit = array()) {
return $blocks;
case 'view':
if (!user_access('access gallery')) {
return;
}
list ($success, $ret) = _gallery_init(true);
if (!$success) {
$err_msg = t('Unable to initialize embedded Gallery. You need to <a href="%link">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment