aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/include/functions.php31
-rw-r--r--include/config_default.inc.php7
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