photo permission inheritance. We want to use the folder permissions unless specific permissions have been set to over-ride them. If nothing is set, use the channel default. We may have to mess with his further in the case of somebody trying to create a public photo directory when their normal permissions are set to private. Kind of a chicken/egg problem because the folder permissions will be empty.
This commit is contained in:
@@ -50,20 +50,32 @@ function photo_upload($channel, $observer, $args) {
|
||||
else
|
||||
$visible = 0;
|
||||
|
||||
$str_group_allow = perms2str(((is_array($args['group_allow'])) ? $args['group_allow'] : explode(',',$args['group_allow'])));
|
||||
$str_contact_allow = perms2str(((is_array($args['contact_allow'])) ? $args['contact_allow'] : explode(',',$args['contact_allow'])));
|
||||
$str_group_deny = perms2str(((is_array($args['group_deny'])) ? $args['group_deny'] : explode(',',$args['group_deny'])));
|
||||
$str_contact_deny = perms2str(((is_array($args['contact_deny'])) ? $args['contact_deny'] : explode(',',$args['contact_deny'])));
|
||||
// Set to default channel permissions. If the parent directory (album) has permissions set,
|
||||
// use those instead. If we have specific permissions supplied, they take precedence over
|
||||
// all other settings.
|
||||
|
||||
$str_group_allow = $channel['channel_allow_gid'];
|
||||
$str_contact_allow = $channel['channel_allow_cid'];
|
||||
$str_group_deny = $channel['channel_deny_gid'];
|
||||
$str_contact_deny = $channel['channel_deny_cid'];
|
||||
|
||||
if($args['directory']) {
|
||||
$str_group_allow = $args['directory']['allow_gid'];
|
||||
$str_contact_allow = $args['directory']['allow_cid'];
|
||||
$str_group_deny = $args['directory']['deny_gid'];
|
||||
$str_contact_deny = $args['directory']['deny_cid'];
|
||||
}
|
||||
|
||||
if( (array_key_exists('group_allow',$args))
|
||||
|| (array_key_exists('contact_allow',$args))
|
||||
|| (array_key_exists('group_deny',$args))
|
||||
|| (array_key_exists('contact_deny',$args))) {
|
||||
|
||||
$str_group_allow = perms2str(((is_array($args['group_allow'])) ? $args['group_allow'] : explode(',',$args['group_allow'])));
|
||||
$str_contact_allow = perms2str(((is_array($args['contact_allow'])) ? $args['contact_allow'] : explode(',',$args['contact_allow'])));
|
||||
$str_group_deny = perms2str(((is_array($args['group_deny'])) ? $args['group_deny'] : explode(',',$args['group_deny'])));
|
||||
$str_contact_deny = perms2str(((is_array($args['contact_deny'])) ? $args['contact_deny'] : explode(',',$args['contact_deny'])));
|
||||
|
||||
if( (! array_key_exists('group_allow',$args))
|
||||
&& (! array_key_exists('contact_allow',$args))
|
||||
&& (! array_key_exists('group_deny',$args))
|
||||
&& (! array_key_exists('contact_deny',$args))) {
|
||||
$str_group_allow = $channel['channel_allow_gid'];
|
||||
$str_contact_allow = $channel['channel_allow_cid'];
|
||||
$str_group_deny = $channel['channel_deny_gid'];
|
||||
$str_contact_deny = $channel['channel_deny_cid'];
|
||||
}
|
||||
|
||||
$os_storage = 0;
|
||||
|
||||
Reference in New Issue
Block a user