extensible perms: the really, really hard part - figuring out what to do about people with custom permissions so as to set sane defaults.
This commit is contained in:
28
boot.php
28
boot.php
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user