aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-08-27 23:04:17 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-08-27 23:04:17 -0700
commitd05fd9632e4dc60fc3d4043374f6332a1609857f (patch)
tree240c3a7bb6ffca008a58789b607b539262c217e5 /mod
parentca0bc2bb7bc2b9e7d81a356a394d47bcb688004c (diff)
downloadvolse-hubzilla-d05fd9632e4dc60fc3d4043374f6332a1609857f.tar.gz
volse-hubzilla-d05fd9632e4dc60fc3d4043374f6332a1609857f.tar.bz2
volse-hubzilla-d05fd9632e4dc60fc3d4043374f6332a1609857f.zip
now we get to the heavy lifting with AccessList stuff
Diffstat (limited to 'mod')
-rw-r--r--mod/filestorage.php14
-rw-r--r--mod/settings.php31
2 files changed, 19 insertions, 26 deletions
diff --git a/mod/filestorage.php b/mod/filestorage.php
index 9787c0380..7ba8c1801 100644
--- a/mod/filestorage.php
+++ b/mod/filestorage.php
@@ -28,20 +28,20 @@ function filestorage_post(&$a) {
return;
}
- $str_group_allow = perms2str($_REQUEST['group_allow']);
- $str_contact_allow = perms2str($_REQUEST['contact_allow']);
- $str_group_deny = perms2str($_REQUEST['group_deny']);
- $str_contact_deny = perms2str($_REQUEST['contact_deny']);
-
$channel = $a->get_channel();
+
+ $acl = new AccessList($channel);
+ $acl->set_from_array($_REQUEST);
+ $x = $acl->get();
+
$cloudPath = get_parent_cloudpath($channel_id, $channel['channel_address'], $resource);
//get the object before permissions change so we can catch eventual former allowed members
$object = get_file_activity_object($channel_id, $resource, $cloudPath);
- attach_change_permissions($channel_id, $resource, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny, $recurse);
+ attach_change_permissions($channel_id, $resource, $x['allow_cid'], $x['allow_gid'], $x['deny_cid'], $x['deny_gid'], $recurse);
- file_activity($channel_id, $object, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny, 'post', $notify);
+ file_activity($channel_id, $object, $x['allow_cid'], $x['allow_gid'], $x['deny_cid'], $x['deny_gid'], 'post', $notify);
goaway($cloudPath);
}
diff --git a/mod/settings.php b/mod/settings.php
index cbd6abafc..8bfff3765 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -311,17 +311,16 @@ function settings_post(&$a) {
foreach($global_perms as $k => $v) {
$set_perms .= ', ' . $v[0] . ' = ' . intval($_POST[$k]) . ' ';
}
-
- $str_group_allow = perms2str($_POST['group_allow']);
- $str_contact_allow = perms2str($_POST['contact_allow']);
- $str_group_deny = perms2str($_POST['group_deny']);
- $str_contact_deny = perms2str($_POST['contact_deny']);
- $r = q("update channel set channel_allow_cid = '%s', channel_allow_gid = '%s', channel_deny_cid = '%s', channel_deny_gid = '%s'
- where channel_id = %d",
- dbesc($str_contact_allow),
- dbesc($str_group_allow),
- dbesc($str_contact_deny),
- dbesc($str_group_deny),
+ $acl = new AccessList($channel);
+ $acl->set_from_array($_POST);
+ $x = $acl->get();
+
+ $r = q("update channel set channel_allow_cid = '%s', channel_allow_gid = '%s',
+ channel_deny_cid = '%s', channel_deny_gid = '%s' where channel_id = %d",
+ dbesc($x['allow_cid']),
+ dbesc($x['allow_gid']),
+ dbesc($x['deny_cid']),
+ dbesc($x['deny_gid']),
intval(local_channel())
);
}
@@ -983,14 +982,8 @@ function settings_content(&$a) {
$stpl = get_markup_template('settings.tpl');
- $celeb = false;
-
- $perm_defaults = array(
- 'allow_cid' => $channel['channel_allow_cid'],
- 'allow_gid' => $channel['channel_allow_gid'],
- 'deny_cid' => $channel['channel_deny_cid'],
- 'deny_gid' => $channel['channel_deny_gid']
- );
+ $acl = new AccessList($channel);
+ $perm_defaults = $acl->get();
require_once('include/group.php');
$group_select = mini_group_select(local_channel(),$channel['channel_default_group']);