aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Settings.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module/Settings.php')
-rw-r--r--Zotlabs/Module/Settings.php58
1 files changed, 27 insertions, 31 deletions
diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php
index b1258e049..af3a25c60 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';
- }
-
-
-
+ }
}
@@ -38,7 +35,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')){
@@ -363,10 +360,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);
@@ -382,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;
@@ -422,20 +419,25 @@ 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())
- );
- 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);
}
- if($p === 'directory_publish') {
- $publish = intval($v);
+ else {
+ del_pconfig(local_channel(),'autoperms',$k);
+ }
+ }
+
+ 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);
@@ -963,11 +965,7 @@ class Settings extends \Zotlabs\Web\Controller {
return $o;
}
-
-
-
-
-
+
if(argv(1) === 'channel') {
require_once('include/acl_selectors.php');
@@ -984,9 +982,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(
@@ -1000,19 +997,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) {
- 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,$limits[$k],'',$options);
}
- // logger('permiss: ' . print_r($permiss,true));
+ //logger('permiss: ' . print_r($permiss,true));