diff options
author | zotlabs <mike@macgirvin.com> | 2016-12-01 15:52:54 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2016-12-01 15:52:54 -0800 |
commit | 97e70d62bf52de9e8879f832cc2d53c74f9c27f3 (patch) | |
tree | 19a3c2849834bc2aa520711a967e90c3e522ca50 /boot.php | |
parent | 47a356ff52900fd8cd8d4980b44c69c13b2e612f (diff) | |
download | volse-hubzilla-97e70d62bf52de9e8879f832cc2d53c74f9c27f3.tar.gz volse-hubzilla-97e70d62bf52de9e8879f832cc2d53c74f9c27f3.tar.bz2 volse-hubzilla-97e70d62bf52de9e8879f832cc2d53c74f9c27f3.zip |
extensible perms: the really, really hard part - figuring out what to do about people with custom permissions so as to set sane defaults.
Diffstat (limited to 'boot.php')
-rwxr-xr-x | boot.php | 28 |
1 files changed, 18 insertions, 10 deletions
@@ -2483,19 +2483,27 @@ function check_for_new_perms() { // get the permissions role details $rp = \Zotlabs\Access\PermissionRoles::role_perms($r[0]['v']); if($rp) { - // set the channel limits if appropriate or 0 - if(array_key_exists('limits',$rp) && array_key_exists($p,$rp['limits'])) { - \Zotlabs\Access\PermissionLimits::Set($cc['uid'],$p,$rp['limits'][$p]); + + // for custom permission roles we need to customise how we initiate this new permission + if(array_key_exists('role',$rp) && ($rp['role'] === 'custom' || $rp['role'] === '')) { + \Zotlabs\Access\PermissionRoles::new_custom_perms($cc['uid'],$p,$x); } else { - \Zotlabs\Access\PermissionLimits::Set($cc['uid'],$p,0); - } + // set the channel limits if appropriate or 0 + if(array_key_exists('limits',$rp) && array_key_exists($p,$rp['limits'])) { + \Zotlabs\Access\PermissionLimits::Set($cc['uid'],$p,$rp['limits'][$p]); + } + else { + \Zotlabs\Access\PermissionLimits::Set($cc['uid'],$p,0); + } + - $set = ((array_key_exists('perms_connect',$rp) && array_key_exists($p,$rp['perms_connect'])) ? true : false); - // foreach connection set to the perms_connect value - if($x) { - foreach($x as $xx) { - set_abconfig($cc['uid'],$xx['abook_xchan'],'my_perms',$p,intval($set)); + $set = ((array_key_exists('perms_connect',$rp) && array_key_exists($p,$rp['perms_connect'])) ? true : false); + // foreach connection set to the perms_connect value + if($x) { + foreach($x as $xx) { + set_abconfig($cc['uid'],$xx['abook_xchan'],'my_perms',$p,intval($set)); + } } } } |