Merge branch 'dev' of ../p3 into dev

This commit is contained in:
zotlabs 2019-11-28 14:07:04 -08:00
commit 8d909a8c72
3 changed files with 15 additions and 2 deletions

View file

@ -28,6 +28,10 @@ class Channel {
$role = ((x($_POST,'permissions_role')) ? notags(trim($_POST['permissions_role'])) : '');
$oldrole = get_pconfig(local_channel(),'system','permissions_role');
$forbidden_roles = [ 'collection', 'collection_restricted' ];
if (in_array($role,$forbidden_roles) || in_array($oldrole,$forbidden_roles)) {
$role = $oldrole;
}
if(($role != $oldrole) || ($role === 'custom')) {
@ -90,7 +94,7 @@ class Channel {
return;
}
}
// no default collection
// no default permissions
else {
q("update channel set channel_default_group = '', channel_allow_gid = '', channel_allow_cid = '', channel_deny_gid = '',
channel_deny_cid = '' where channel_id = %d",
@ -531,6 +535,9 @@ class Channel {
$permissions_set = (($permissions_role != 'custom') ? true : false);
$perm_roles = PermissionRoles::roles();
// Don't permit changing to a collection (@TODO unless there is a mechanism to select the channel_parent)
unset($perm_roles['Collection']);
$vnotify = get_pconfig(local_channel(),'system','vnotify');
$always_show_in_notices = get_pconfig(local_channel(),'system','always_show_in_notices');
@ -588,6 +595,8 @@ class Channel {
'$deny_gid' => acl2json($perm_defaults['deny_gid']),
'$suggestme' => $suggestme,
'$group_select' => $group_select,
'$can_change_role' => ((in_array($permissions_role, [ 'collection', 'collection_restricted'] )) ? false : true),
'$permissions_role' => $permissions_role,
'$role' => array('permissions_role' , t('Channel role and privacy'), $permissions_role, '', $perm_roles),
'$defpermcat' => [ 'defpermcat', t('Default Permissions Group'), $default_permcat, '', $permcats ],
'$permcat_enable' => feature_enabled(local_channel(),'permcats'),

View file

@ -246,7 +246,7 @@ function create_identity($arr) {
if(array_key_exists('permissions_role',$arr) && $arr['permissions_role']) {
$role_permissions = PermissionRoles::role_perms($arr['permissions_role']);
if(isset($role_permissions['channel_type']) && $role_permissions['channel_type'] == 'collection') {
if(isset($role_permissions['channel_type']) && $role_permissions['channel_type'] === 'collection') {
$parent_channel_hash = $arr['parent_hash'];
}
}

View file

@ -43,7 +43,11 @@
</div>
<div id="privacy-settings-collapse" class="collapse" role="tabpanel" aria-labelledby="privacy-settings" data-parent="#settings">
<div class="section-content-tools-wrapper">
{{if $can_change_role}}
{{include file="field_select_grouped.tpl" field=$role}}
{{else}}
<input type="hidden" name="permissions_role" value="{{$permissions_role}}">
{{/if}}
{{$autoperms}}
{{$anymention}}
{{include file="field_select.tpl" field=$comment_perms}}