diff options
author | flop25 <flop25@piwigo.org> | 2013-06-16 19:52:51 +0000 |
---|---|---|
committer | flop25 <flop25@piwigo.org> | 2013-06-16 19:52:51 +0000 |
commit | c17bc66aeb4cbbe4ec17b8b6b6ef9b3d66d89664 (patch) | |
tree | cee0b0443d131cf1fbd6cbc1f62c6070267d022e | |
parent | 272a55d377f104a03f3fd0d2cc3c0e8c6497e57b (diff) |
bug:2855
new otpion "inherit" for create_virtual_category(), and $conf['inheritance_by_default'] = false;
ToDo: album registred from Ftp
git-svn-id: http://piwigo.org/svn/trunk@23272 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/include/functions.php | 31 | ||||
-rw-r--r-- | include/config_default.inc.php | 7 |
2 files changed, 37 insertions, 1 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php index 02917394a..2a6084f8d 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -1303,7 +1303,36 @@ SELECT id, uppercats, global_rank, visible, status update_global_rank(); - if ('private' == $insert['status']) + if ('private' == $insert['status'] and ((isset($options['inherit']) and $options['inherit']) or $conf['inheritance_by_default']) ) + { + $query = ' + SELECT group_id + FROM '.GROUP_ACCESS_TABLE.' + WHERE cat_id = '.$insert['id_uppercat'].' + ;'; + $granted_grps = array_from_query($query, 'group_id'); + $inserts = array(); + foreach ($granted_grps as $granted_grp) + { + array_push( + $inserts, + array( + 'group_id' => $granted_grp, + 'cat_id' => $inserted_id + ) + ); + } + mass_inserts(GROUP_ACCESS_TABLE, array('group_id','cat_id'), $inserts); + + $query = ' + SELECT user_id + FROM '.USER_ACCESS_TABLE.' + WHERE cat_id = '.$insert['id_uppercat'].' + ;'; + $granted_users = array_from_query($query, 'user_id'); + add_permission_on_category($inserted_id, array_unique(array_merge(get_admins(), array($user['id']), $granted_users))); + } + else if ('private' == $insert['status']) { add_permission_on_category($inserted_id, array_unique(array_merge(get_admins(), array($user['id'])))); } diff --git a/include/config_default.inc.php b/include/config_default.inc.php index 9f812450b..8816e8a42 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -786,4 +786,11 @@ $conf['max_requests']=3; // one of '', 'images', 'all' //TODO: Put this in admin and also manage .htaccess in #sites and upload folders $conf['original_url_protection'] = ''; + + +// Default behaviour when a new album is created: should the new album inherit the group/user +// permissions from its parent? Note that config is only used for Ftp synchro, +// and if that option is not explicitly transmit when the album is created. +$conf['inheritance_by_default'] = false; + ?>
\ No newline at end of file |