Commit e6224898 authored by redmatrix's avatar redmatrix

more heavy lifting on xtensible perms

parent d566ffa6
......@@ -11,7 +11,7 @@ class PermissionLimits {
if($r) {
if($r[0]['perm_limit'] != $perm_limit) {
$x = q("update perm_limits set perm_limit = %d where id = %d",
dbesc($perm_limit)
dbesc($perm_limit),
intval($r[0]['id'])
);
}
......@@ -29,7 +29,7 @@ class PermissionLimits {
static public function Get($channel_id,$perm = '') {
if($perm) {
$r = q("select * from perm_limits where channel_id = %d and perm = '%s' limit 1",
intval($channel_id)
intval($channel_id),
dbesc($perm)
);
if($r)
......
......@@ -7,8 +7,8 @@ use Zotlabs\Lib as Zlib;
class PermissionRoles {
static private role_limits = array();
static private role_perms = array();
static private $role_limits = array();
static private $role_perms = array();
static public function roles() {
$roles = [
......
......@@ -197,8 +197,11 @@ class Connedit extends \Zotlabs\Web\Controller {
$role = get_pconfig(local_channel(),'system','permissions_role');
if($role) {
$x = get_role_perms($role);
if($x['perms_accept'])
$abook_my_perms = $x['perms_accept'];
if($x['perms_connect']) {
foreach($x['perms_connect'] as $p) {
set_abconfig(local_channel(),$orig_record[0]['abook_xchan'],'my_perms',$p,1);
}
}
}
}
......@@ -374,8 +377,8 @@ class Connedit extends \Zotlabs\Web\Controller {
$role = get_pconfig(local_channel(),'system','permissions_role');
if($role) {
$x = get_role_perms($role);
if($x['perms_accept'])
$my_perms = $x['perms_accept'];
if($x['perms_connect'])
$my_perms = $x['perms_connect'];
}
$yes_no = array(t('No'),t('Yes'));
......
......@@ -371,7 +371,7 @@ class Settings extends \Zotlabs\Web\Controller {
}
foreach($global_perms as $k => $v) {
set_abconfig(local_channel(),$channel['channel_hash'],'my_perms',$k,((array_key_exists($k,$role_permissions['perms_accept'])) ? intval($role_permissions['perms_accept'][$k])));
set_abconfig(local_channel(),$channel['channel_hash'],'my_perms',$k,((array_key_exists($k,$role_permissions['perms_connect'])) ? 1 : 0));
}
set_pconfig(local_channel(),'system','autoperms',(($role_permissions['perms_auto']) ? intval($role_permissions['perms_accept']) : 0));
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment