From 09ef30feb0e6f38ee3de34a37270cf796850b3d4 Mon Sep 17 00:00:00 2001 From: Treer Date: Sun, 8 May 2016 21:27:52 +1000 Subject: Update some modules to use new ACL dialog feature --- Zotlabs/Module/Channel.php | 3 ++- Zotlabs/Module/Editwebpage.php | 3 ++- Zotlabs/Module/Events.php | 7 +++++-- Zotlabs/Module/Filestorage.php | 4 +++- Zotlabs/Module/Network.php | 3 ++- Zotlabs/Module/Photos.php | 5 +++-- Zotlabs/Module/Rpost.php | 3 ++- Zotlabs/Module/Settings.php | 4 +++- Zotlabs/Module/Webpages.php | 3 ++- 9 files changed, 24 insertions(+), 11 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 47c5f31fb..f55705442 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -9,6 +9,7 @@ require_once('include/security.php'); require_once('include/conversation.php'); require_once('include/acl_selectors.php'); require_once('include/permissions.php'); +require_once('include/PermissionDescription.php'); class Channel extends \Zotlabs\Web\Controller { @@ -132,7 +133,7 @@ function get($update = 0, $load = false) { 'default_location' => (($is_owner) ? \App::$profile['channel_location'] : ''), 'nickname' => \App::$profile['channel_address'], 'lockstate' => (((strlen(\App::$profile['channel_allow_cid'])) || (strlen(\App::$profile['channel_allow_gid'])) || (strlen(\App::$profile['channel_deny_cid'])) || (strlen(\App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'), - 'acl' => (($is_owner) ? populate_acl($channel_acl,true,((\App::$profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : ''), get_post_aclDialogDescription(), 'acl_dialog_post') : ''), + 'acl' => (($is_owner) ? populate_acl($channel_acl,true, \PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post') : ''), 'showacl' => (($is_owner) ? 'yes' : ''), 'bang' => '', 'visitor' => (($is_owner || $observer) ? true : false), diff --git a/Zotlabs/Module/Editwebpage.php b/Zotlabs/Module/Editwebpage.php index d3b031db2..5bd75df4a 100644 --- a/Zotlabs/Module/Editwebpage.php +++ b/Zotlabs/Module/Editwebpage.php @@ -3,6 +3,7 @@ namespace Zotlabs\Module; require_once('include/identity.php'); require_once('include/acl_selectors.php'); +require_once('include/PermissionDescription.php'); class Editwebpage extends \Zotlabs\Web\Controller { @@ -195,7 +196,7 @@ class Editwebpage extends \Zotlabs\Web\Controller { '$baseurl' => z_root(), '$defloc' => $itm[0]['location'], '$visitor' => ($is_owner) ? true : false, - '$acl' => populate_acl($itm[0],false), + '$acl' => populate_acl($itm[0],false,\PermissionDescription::fromGlobalPermission('view_pages')), '$showacl' => ($is_owner) ? true : false, '$public' => t('Public post'), '$jotnets' => $jotnets, diff --git a/Zotlabs/Module/Events.php b/Zotlabs/Module/Events.php index a14e320b2..9519ca11b 100644 --- a/Zotlabs/Module/Events.php +++ b/Zotlabs/Module/Events.php @@ -6,6 +6,7 @@ require_once('include/bbcode.php'); require_once('include/datetime.php'); require_once('include/event.php'); require_once('include/items.php'); +require_once('include/PermissionDescription.php'); class Events extends \Zotlabs\Web\Controller { @@ -237,7 +238,7 @@ class Events extends \Zotlabs\Web\Controller { - function get() { + function get() { if(argc() > 2 && argv(1) == 'ical') { $event_id = argv(2); @@ -468,7 +469,9 @@ class Events extends \Zotlabs\Web\Controller { '$share' => array('share', t('Share this event'), $sh_checked, '', array(t('No'),t('Yes'))), '$preview' => t('Preview'), '$permissions' => t('Permission settings'), - '$acl' => (($orig_event['event_xchan']) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $perm_defaults),false)), + // populating the acl dialog was a permission description from view_stream because Cal.php, which + // displays events, says "since we don't currently have an event permission - use the stream permission" + '$acl' => (($orig_event['event_xchan']) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $perm_defaults), false, \PermissionDescription::fromGlobalPermission('view_stream'))), '$submit' => t('Submit'), '$advanced' => t('Advanced Options') diff --git a/Zotlabs/Module/Filestorage.php b/Zotlabs/Module/Filestorage.php index 934a1e6a4..2861f31be 100644 --- a/Zotlabs/Module/Filestorage.php +++ b/Zotlabs/Module/Filestorage.php @@ -6,6 +6,8 @@ namespace Zotlabs\Module; */ require_once('include/attach.php'); +require_once('include/PermissionDescription.php'); + /** * @@ -132,7 +134,7 @@ class Filestorage extends \Zotlabs\Web\Controller { $cloudpath = get_cloudpath($f) . (intval($f['is_dir']) ? '?f=&davguest=1' : ''); $parentpath = get_parent_cloudpath($channel['channel_id'], $channel['channel_address'], $f['hash']); - $aclselect_e = populate_acl($f, false); + $aclselect_e = populate_acl($f, false, \PermissionDescription::fromGlobalPermission('view_storage')); $is_a_dir = (intval($f['is_dir']) ? true : false); $lockstate = (($f['allow_cid'] || $f['allow_gid'] || $f['deny_cid'] || $f['deny_gid']) ? 'lock' : 'unlock'); diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 2badd7280..fdfa99c12 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -6,6 +6,7 @@ require_once('include/group.php'); require_once('include/contact_widgets.php'); require_once('include/conversation.php'); require_once('include/acl_selectors.php'); +require_once('include/PermissionDescription.php'); @@ -170,7 +171,7 @@ class Network extends \Zotlabs\Web\Controller { 'default_location' => $channel['channel_location'], 'nickname' => $channel['channel_address'], 'lockstate' => (($private_editing || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), - 'acl' => populate_acl((($private_editing) ? $def_acl : $channel_acl), true, (($channel['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : ''), get_post_aclDialogDescription(), 'acl_dialog_post'), + 'acl' => populate_acl((($private_editing) ? $def_acl : $channel_acl), true, \PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'), 'bang' => (($private_editing) ? '!' : ''), 'visitor' => true, 'profile_uid' => local_channel(), diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index 2b7f5525f..1659350a5 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -9,6 +9,7 @@ require_once('include/security.php'); require_once('include/Contact.php'); require_once('include/attach.php'); require_once('include/text.php'); +require_once('include/PermissionDescription.php'); @@ -632,7 +633,7 @@ class Photos extends \Zotlabs\Web\Controller { $lockstate = (($acl->is_private()) ? 'lock' : 'unlock'); } - $aclselect = (($_is_owner) ? populate_acl($channel_acl,false) : ''); + $aclselect = (($_is_owner) ? populate_acl($channel_acl,false, \PermissionDescription::fromGlobalPermission('view_storage')) : ''); // this is wrong but is to work around an issue with js_upload wherein it chokes if these variables // don't exist. They really should be set to a parseable representation of the channel's default permissions @@ -1022,7 +1023,7 @@ class Photos extends \Zotlabs\Web\Controller { if($can_post) { $album_e = $ph[0]['album']; $caption_e = $ph[0]['description']; - $aclselect_e = (($_is_owner) ? populate_acl($ph[0]) : ''); + $aclselect_e = (($_is_owner) ? populate_acl($ph[0], true, \PermissionDescription::fromGlobalPermission('view_storage')) : ''); $albums = ((array_key_exists('albums', \App::$data)) ? \App::$data['albums'] : photos_albums_list(\App::$data['channel'],\App::$data['observer'])); $_SESSION['album_return'] = bin2hex($ph[0]['album']); diff --git a/Zotlabs/Module/Rpost.php b/Zotlabs/Module/Rpost.php index 41889c35c..1396f2a55 100644 --- a/Zotlabs/Module/Rpost.php +++ b/Zotlabs/Module/Rpost.php @@ -7,6 +7,7 @@ require_once('include/items.php'); require_once('include/taxonomy.php'); require_once('include/conversation.php'); require_once('include/zot.php'); +require_once('include/PermissionDescription.php'); /** * remote post @@ -115,7 +116,7 @@ class Rpost extends \Zotlabs\Web\Controller { 'default_location' => $channel['channel_location'], 'nickname' => $channel['channel_address'], 'lockstate' => (($acl->is_private()) ? 'lock' : 'unlock'), - 'acl' => populate_acl($channel_acl,true,(($channel['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : ''), get_post_aclDialogDescription(), 'acl_dialog_post'), + 'acl' => populate_acl($channel_acl, true, \PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'), 'bang' => '', 'visitor' => true, 'profile_uid' => local_channel(), diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index 413648c4d..8674ca5e7 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -2,6 +2,8 @@ namespace Zotlabs\Module; /** @file */ require_once('include/zot.php'); +require_once('include/PermissionDescription.php'); + class Settings extends \Zotlabs\Web\Controller { @@ -1064,7 +1066,7 @@ class Settings extends \Zotlabs\Web\Controller { '$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']) , t('May reduce spam activity')), '$permissions' => t('Default Post Permissions'), '$permdesc' => t("\x28click to open/close\x29"), - '$aclselect' => populate_acl($perm_defaults,false), + '$aclselect' => populate_acl($perm_defaults, false, \PermissionDescription::fromDescription(t('Use my default audience setting for the type of channel'))), '$suggestme' => $suggestme, '$group_select' => $group_select, '$role' => array('permissions_role' , t('Channel permissions category:'), $permissions_role, '', get_roles()), diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php index 84d58058e..18dd57473 100644 --- a/Zotlabs/Module/Webpages.php +++ b/Zotlabs/Module/Webpages.php @@ -4,6 +4,7 @@ namespace Zotlabs\Module; require_once('include/identity.php'); require_once('include/conversation.php'); require_once('include/acl_selectors.php'); +require_once('include/PermissionDescription.php'); class Webpages extends \Zotlabs\Web\Controller { @@ -111,7 +112,7 @@ class Webpages extends \Zotlabs\Web\Controller { 'nickname' => \App::$profile['channel_address'], 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), 'bang' => '', - 'acl' => (($is_owner) ? populate_acl($channel_acl,false) : ''), + 'acl' => (($is_owner) ? populate_acl($channel_acl,false, \PermissionDescription::fromGlobalPermission('view_pages')) : ''), 'showacl' => (($is_owner) ? true : false), 'visitor' => true, 'profile_uid' => intval($owner), -- cgit v1.2.3