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 /Zotlabs/Access/PermissionRoles.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 'Zotlabs/Access/PermissionRoles.php')
-rw-r--r-- | Zotlabs/Access/PermissionRoles.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Zotlabs/Access/PermissionRoles.php b/Zotlabs/Access/PermissionRoles.php index 8b116adc5..3878777cf 100644 --- a/Zotlabs/Access/PermissionRoles.php +++ b/Zotlabs/Access/PermissionRoles.php @@ -160,6 +160,7 @@ class PermissionRoles { $ret['limits'] = PermissionLimits::Std_Limits(); break; + case 'custom': default: break; } @@ -174,7 +175,48 @@ class PermissionRoles { return $ret; } + static public function new_custom_perms($uid,$perm,$abooks) { + // set permissionlimits for this permission here, for example: + + // if($perm === 'mynewperm') + // \Zotlabs\Access\PermissionLimits::Set($uid,$perm,1); + + + // set autoperms here if applicable + // choices are to set to 0, 1, or the value of an existing perm + + if(get_pconfig($uid,'system','autoperms')) { + + $c = channelx_by_n($uid); + $value = 0; + + // if($perm === 'mynewperm') + // $value = get_abconfig($uid,$c['channel_hash'],'autoperms','someexistingperm')); + + if($c) { + set_abconfig($uid,$c['channel_hash'],'autoperms',$perm,$value); + } + + + } + + // now set something for all existing connections. + + if($abooks) { + foreach($abooks as $ab) { + switch($perm) { + // case 'mynewperm': + // choices are to set to 1, set to 0, or clone an existing perm + // set_abconfig($uid,$ab['abook_xchan'],'my_perms',$perm, + // get_abconfig($uid,$ab['abook_xchan'],'my_perms','someexistingperm')); + + default: + break; + } + } + } + } static public function roles() { |