aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-02-01 18:05:02 -0800
committerzotlabs <mike@macgirvin.com>2017-02-01 18:05:02 -0800
commit94290102b6e1b29b29c58318670da797394550c1 (patch)
tree12bdfade060ccab26480913583ad544239c2e1f5 /boot.php
parentf94c244b9f6d1d1ccda36adeda08f2d04684a4a2 (diff)
downloadvolse-hubzilla-94290102b6e1b29b29c58318670da797394550c1.tar.gz
volse-hubzilla-94290102b6e1b29b29c58318670da797394550c1.tar.bz2
volse-hubzilla-94290102b6e1b29b29c58318670da797394550c1.zip
tested extensible permissions by adding wiki permissions. Discovered a couple of issues that needed attention in the process.
Diffstat (limited to 'boot.php')
-rwxr-xr-xboot.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/boot.php b/boot.php
index 5fe42a03f..8d007d805 100755
--- a/boot.php
+++ b/boot.php
@@ -2464,6 +2464,7 @@ function check_for_new_perms() {
return;
$pregistered = get_config('system','perms');
+
$pcurrent = array_keys(\Zotlabs\Access\Permissions::Perms());
if(! $pregistered) {
@@ -2475,6 +2476,7 @@ function check_for_new_perms() {
foreach($pcurrent as $p) {
if(! in_array($p,$pregistered)) {
+
$found_new_perm = true;
// for all channels
$c = q("select channel_id from channel where true");
@@ -2482,12 +2484,12 @@ function check_for_new_perms() {
foreach($c as $cc) {
// get the permission role
$r = q("select v from pconfig where uid = %d and cat = 'system' and k = 'permissions_role'",
- intval($cc['uid'])
+ intval($cc['channel_id'])
);
if($r) {
// get a list of connections
$x = q("select abook_xchan from abook where abook_channel = %d and abook_self = 0",
- intval($cc['uid'])
+ intval($cc['channel_id'])
);
// get the permissions role details
$rp = \Zotlabs\Access\PermissionRoles::role_perms($r[0]['v']);
@@ -2495,23 +2497,23 @@ function check_for_new_perms() {
// 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);
+ \Zotlabs\Access\PermissionRoles::new_custom_perms($cc['channel_id'],$p,$x);
}
else {
// 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]);
+ \Zotlabs\Access\PermissionLimits::Set($cc['channel_id'],$p,$rp['limits'][$p]);
}
else {
- \Zotlabs\Access\PermissionLimits::Set($cc['uid'],$p,0);
+ \Zotlabs\Access\PermissionLimits::Set($cc['channel_id'],$p,0);
}
- $set = ((array_key_exists('perms_connect',$rp) && array_key_exists($p,$rp['perms_connect'])) ? true : false);
+ $set = ((array_key_exists('perms_connect',$rp) && in_array($p,$rp['perms_connect'])) ? 1 : 0);
// 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_abconfig($cc['channel_id'],$xx['abook_xchan'],'my_perms',$p,intval($set));
}
}
}