diff options
author | redmatrix <git@macgirvin.com> | 2016-07-13 20:23:20 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-07-13 20:23:20 -0700 |
commit | 503b42029212a61ce4aefcf63eb2a865ee334619 (patch) | |
tree | e02b0bb620a9b0ed73ea83a6859177c0cd2fc15c | |
parent | 0aa205044b195d7ffd378b247bb4f90a9df7645a (diff) | |
download | volse-hubzilla-503b42029212a61ce4aefcf63eb2a865ee334619.tar.gz volse-hubzilla-503b42029212a61ce4aefcf63eb2a865ee334619.tar.bz2 volse-hubzilla-503b42029212a61ce4aefcf63eb2a865ee334619.zip |
rework perm_is_allowed
-rw-r--r-- | include/permissions.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/include/permissions.php b/include/permissions.php index bc3cfdd2a..638bedb24 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -81,7 +81,7 @@ function get_all_perms($uid, $observer_xchan, $internal_use = true) { $ret = array(); - $abperms = (($uid && $observer_xchan) ? load_abconfig($uid,$observer_xchan) : array()); + $abperms = (($uid && $observer_xchan) ? load_abconfig($uid,$observer_xchan,'my_perms') : array()); foreach($global_perms as $perm_name => $permission) { @@ -333,7 +333,7 @@ function perm_is_allowed($uid, $observer_xchan, $permission) { dbesc($observer_xchan) ); } - $abperms = load_abconfig($uid,$observer_xchan); + $abperms = load_abconfig($uid,$observer_xchan,'my_perms'); } @@ -407,8 +407,12 @@ function perm_is_allowed($uid, $observer_xchan, $permission) { // Permission granted to certain channels. Let's see if the observer is one of them if(($r) && ($channel_perm & PERMS_SPECIFIC)) { - if(array_key_exists('my_perms',$abperms) && array_key_exists($permission,$abperms['my_perms']) && $abperms['my_perms'][$permission]) { - return true; + if($abperms) { + foreach($abperms as $ab) { + if($ab['cat'] == 'my_perms' && $ab['k'] == $permission) { + return ((intval($ab['v'])) ? true : false); + } + } } } |