From 2a26b0ae91281efd09320ac1950e4345fe7e9771 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 3 Jul 2016 22:47:46 -0700 Subject: perms work - settings page --- Zotlabs/Module/Settings.php | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'Zotlabs/Module/Settings.php') diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index 875004fae..5c9ff1db0 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -30,7 +30,7 @@ class Settings extends \Zotlabs\Web\Controller { } - function post() { + function post() { if(! local_channel()) return; @@ -40,7 +40,7 @@ class Settings extends \Zotlabs\Web\Controller { $channel = \App::get_channel(); - logger('mod_settings: ' . print_r($_REQUEST,true)); + // logger('mod_settings: ' . print_r($_REQUEST,true)); if((argc() > 1) && (argv(1) === 'oauth') && x($_POST,'remove')){ @@ -311,10 +311,10 @@ class Settings extends \Zotlabs\Web\Controller { intval(local_channel()) ); - $global_perms = get_perms(); + $global_perms = \Zotlabs\Access\Permissions::Perms(); foreach($global_perms as $k => $v) { - $set_perms .= ', ' . $v[0] . ' = ' . intval($_POST[$k]) . ' '; + \Zotlabs\Access\PermissionLimits::Set(local_channel(),$k,intval($_POST[$k])); } $acl = new \Zotlabs\Access\AccessList($channel); $acl->set_from_array($_POST); @@ -370,10 +370,10 @@ class Settings extends \Zotlabs\Web\Controller { ); } - $r = q("update abook set abook_my_perms = %d where abook_channel = %d and abook_self = 1", - intval((array_key_exists('perms_accept',$role_permissions)) ? $role_permissions['perms_accept'] : 0), - intval(local_channel()) - ); + 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_pconfig(local_channel(),'system','autoperms',(($role_permissions['perms_auto']) ? intval($role_permissions['perms_accept']) : 0)); foreach($role_permissions as $p => $v) { @@ -864,11 +864,7 @@ class Settings extends \Zotlabs\Web\Controller { return $o; } - - - - - + if(argv(1) === 'channel') { require_once('include/acl_selectors.php'); @@ -885,9 +881,8 @@ class Settings extends \Zotlabs\Web\Controller { $channel = \App::get_channel(); - - $global_perms = get_perms(); - + $global_perms = \Zotlabs\Access\Permissions::Perms(); + $permiss = array(); $perm_opts = array( @@ -905,15 +900,13 @@ class Settings extends \Zotlabs\Web\Controller { foreach($global_perms as $k => $perm) { $options = array(); foreach($perm_opts as $opt) { - if((! $perm[2]) && $opt[1] == PERMS_PUBLIC) - continue; $options[$opt[1]] = $opt[0]; } - $permiss[] = array($k,$perm[3],$channel[$perm[0]],$perm[4],$options); + $permiss[] = array($k,$perm,$channel[$perm[0]],$perm[4],$options); } - // logger('permiss: ' . print_r($permiss,true)); + // logger('permiss: ' . print_r($permiss,true)); -- cgit v1.2.3 From e6224898d29b605da6751b6744f0e544250b600a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 4 Jul 2016 21:33:25 -0700 Subject: more heavy lifting on xtensible perms --- Zotlabs/Module/Settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Settings.php') diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index 5c9ff1db0..85da261fc 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -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)); -- cgit v1.2.3 From c9db8c6857d8676b3eb3c19548eb303656dc5fff Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 9 Jul 2016 21:08:02 -0700 Subject: more permissions work --- Zotlabs/Module/Settings.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Settings.php') diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index 85da261fc..7f34f52b1 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -896,17 +896,18 @@ class Settings extends \Zotlabs\Web\Controller { array( t('Anybody on the internet'), PERMS_PUBLIC) ); + $limits = \Zotlabs\Access\PermissionLimits::Get(local_channel()); foreach($global_perms as $k => $perm) { $options = array(); foreach($perm_opts as $opt) { $options[$opt[1]] = $opt[0]; } - $permiss[] = array($k,$perm,$channel[$perm[0]],$perm[4],$options); + $permiss[] = array($k,$perm,$limits[$k],'',$options); } - // logger('permiss: ' . print_r($permiss,true)); + //logger('permiss: ' . print_r($permiss,true)); -- cgit v1.2.3 From b63165b6e0d856848b20d184783bfdf358210f9b Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 18 Jul 2016 21:37:34 -0700 Subject: more perms work (a lot more) --- Zotlabs/Module/Settings.php | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'Zotlabs/Module/Settings.php') diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index 81d76a2dd..514078b2f 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -21,10 +21,7 @@ class Settings extends \Zotlabs\Web\Controller { // We are setting these values - don't use the argc(), argv() functions here \App::$argc = 2; \App::$argv[] = 'channel'; - } - - - + } } @@ -422,20 +419,25 @@ 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_connect'])) ? 1 : 0)); - } - - set_pconfig(local_channel(),'system','autoperms',(($role_permissions['perms_auto']) ? intval($role_permissions['perms_accept']) : 0)); - - foreach($role_permissions as $p => $v) { - if(strpos($p,'channel_') !== false) { - $set_perms .= ', ' . $p . ' = ' . intval($v) . ' '; + $x = \Zotlabs\Access\Permissions::FilledPerms($role_permissions['perms_connect']); + foreach($x as $k => $v) { + set_abconfig(local_channel(),$channel['channel_hash'],'my_perms',$k, $v); + if($role_permissions['perms_auto']) { + set_pconfig(local_channel(),'autoperms',$k,$v); + } + else { + del_pconfig(local_channel(),'autoperms',$k); } - if($p === 'directory_publish') { - $publish = intval($v); + } + + if($role_permissions['limits']) { + foreach($role_permissions['limits'] as $k => $v) { + \Zotlabs\Access\PermissionLimits::Set(local_channel(),$k,$v); } } + if(array_key_exists('directory_publish',$role_permissions)) { + $publish = intval($role_permissions['directory_publish']); + } } set_pconfig(local_channel(),'system','hide_online_status',$hide_presence); -- cgit v1.2.3 From ea830328634b084e44f9e16f037a8bef3c98280a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 19 Jul 2016 17:52:45 -0700 Subject: translate more old perms calls --- Zotlabs/Module/Settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Settings.php') diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index 514078b2f..af3a25c60 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -379,7 +379,7 @@ class Settings extends \Zotlabs\Web\Controller { ); } else { - $role_permissions = get_role_perms($_POST['permissions_role']); + $role_permissions = \Zotlabs\Access\PermissionRoles::role_perms($_POST['permissions_role']); if(! $role_permissions) { notice('Permissions category could not be found.'); return; -- cgit v1.2.3