From c50bfa07ca3a456d69d73988f42e58e3282879e9 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 3 Aug 2016 21:16:57 +0200 Subject: multiple acl work --- Zotlabs/Module/Channel.php | 3 +- Zotlabs/Module/Filestorage.php | 7 +++- Zotlabs/Module/Network.php | 1 + include/conversation.php | 6 +++ include/text.php | 6 +++ view/js/acl.js | 86 ++++++++++++++++++++++++++++------------- view/tpl/acl_selector.tpl | 6 +-- view/tpl/attach_edit.tpl | 8 ++-- view/tpl/chatroom_new.tpl | 6 +-- view/tpl/cloud_actionspanel.tpl | 1 + view/tpl/jot.tpl | 9 +++-- 11 files changed, 96 insertions(+), 43 deletions(-) diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index c74802ec5..59cb9f06c 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -133,6 +133,7 @@ class Channel extends \Zotlabs\Web\Controller { '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, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post') : ''), + 'permissions' => (($is_owner) ? $channel_acl : ''), 'showacl' => (($is_owner) ? 'yes' : ''), 'bang' => '', 'visitor' => (($is_owner || $observer) ? true : false), @@ -363,4 +364,4 @@ class Channel extends \Zotlabs\Web\Controller { return $o; } -} \ No newline at end of file +} diff --git a/Zotlabs/Module/Filestorage.php b/Zotlabs/Module/Filestorage.php index c3ef22e32..c8ad147bb 100644 --- a/Zotlabs/Module/Filestorage.php +++ b/Zotlabs/Module/Filestorage.php @@ -161,7 +161,12 @@ class Filestorage extends \Zotlabs\Web\Controller { '$submit' => t('Submit'), '$attach_btn_title' => t('Share this file'), '$link_btn_title' => t('Show URL to this file'), - '$notify' => array('notify', t('Notify your contacts about this file'), 0, '', array(t('No'), t('Yes'))) + '$notify' => array('notify', t('Notify your contacts about this file'), 0, '', array(t('No'), t('Yes'))), + + '$allow_cid' => json_encode(expand_acl($f['allow_cid'])), + '$allow_gid' => json_encode(expand_acl($f['allow_gid'])), + '$deny_cid' => json_encode(expand_acl($f['deny_cid'])), + '$deny_cid' => json_encode(expand_acl($f['deny_gid'])) )); echo $o; diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 3b88cd8d6..0128adc2c 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -170,6 +170,7 @@ class Network extends \Zotlabs\Web\Controller { '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, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'), + 'permissions' => (($private_editing) ? $def_acl : $channel_acl), 'bang' => (($private_editing) ? '!' : ''), 'visitor' => true, 'profile_uid' => local_channel(), diff --git a/include/conversation.php b/include/conversation.php index 1efca37f3..f68d538dc 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1213,6 +1213,8 @@ function status_editor($a, $x, $popup = false) { call_hooks('jot_tool', $jotplugins); + //print_r(acl2json($x['permissions']['allow_gid'])); killme(); + $o .= replace_macros($tpl, array( '$return_path' => ((x($x, 'return_path')) ? $x['return_path'] : App::$query_string), '$action' => z_root() . '/item', @@ -1253,6 +1255,10 @@ function status_editor($a, $x, $popup = false) { '$visitor' => $x['visitor'], '$lockstate' => $x['lockstate'], '$acl' => $x['acl'], + '$allow_cid' => acl2json($x['permissions']['allow_cid']), + '$allow_gid' => acl2json($x['permissions']['allow_gid']), + '$deny_cid' => acl2json($x['permissions']['deny_cid']), + '$deny_gid' => acl2json($x['permissions']['deny_gid']), '$mimeselect' => $mimeselect, '$layoutselect' => $layoutselect, '$showacl' => ((array_key_exists('showacl', $x)) ? $x['showacl'] : true), diff --git a/include/text.php b/include/text.php index 1eec2ba0a..6d7d0ed8d 100644 --- a/include/text.php +++ b/include/text.php @@ -2796,6 +2796,12 @@ function expand_acl($s) { return $ret; } +function acl2json($s) { + $s = expand_acl($s); + $s = json_encode($s); + return $s; +} + // When editing a webpage - a dropdown is needed to select a page layout // On submit, the pdl_select value (which is the mid of an item with item_type = ITEM_TYPE_PDL) is stored in diff --git a/view/js/acl.js b/view/js/acl.js index 79699c589..33895d260 100644 --- a/view/js/acl.js +++ b/view/js/acl.js @@ -1,15 +1,17 @@ -function ACL(backend_url, preset) { +function ACL(backend_url) { that = this; that.url = backend_url; that.kp_timer = null; - if (preset === undefined) preset = []; - that.allow_cid = (preset[0] || []); - that.allow_gid = (preset[1] || []); - that.deny_cid = (preset[2] || []); - that.deny_gid = (preset[3] || []); + that.self = []; + + that.allow_cid = []; + that.allow_gid = []; + that.deny_cid = []; + that.deny_gid = []; + that.group_uids = []; that.info = $("#acl-info"); @@ -21,11 +23,8 @@ function ACL(backend_url, preset) { that.showlimited = $("#acl-showlimited"); that.acl_select = $("#acl-select"); - that.preset = preset; - that.self = []; - // set the initial ACL lists in case the enclosing form gets submitted before the ajax loader completes. - that.on_submit(); + //that.on_submit(); /*events*/ @@ -47,32 +46,59 @@ function ACL(backend_url, preset) { } }); + + //$(document).on('click', '.acl-submit', that.get_form_id_and_submit); + //$(document).on('click', '.acl-select', that.get_form_id_and_submit); + + $(document).on('focus', '.acl-form', that.get_form_data); + $(document).on('click', '.acl-form', that.get_form_data); + $(document).on('click','.acl-button-show',that.on_button_show); $(document).on('click','.acl-button-hide',that.on_button_hide); + $(document).on('click','.acl-button-hide',that.on_button_hide); + $("#acl-search").keypress(that.on_search); /* startup! */ that.get(0,15000); - that.on_submit(); + //that.on_submit(); }); } // no longer called only on submit - call to update whenever a change occurs to the acl list. +ACL.prototype.get_form_data = function(event) { +//event.preventDefault() + + that.form_id = $(this).data('formid'); + + console.log(event); + + that.allow_cid = ($(this).data('allow_cid') || []); + that.allow_gid = ($(this).data('allow_gid') || []); + that.deny_cid = ($(this).data('deny_cid') || []); + that.deny_gid = ($(this).data('deny_gid') || []); + + that.update_view(); + that.on_submit(); +} ACL.prototype.on_submit = function() { - aclfields = $("#acl-fields").html(""); + + + //console.log(that.form_id); + $('.acl-field').remove(); $(that.allow_gid).each(function(i,v) { - aclfields.append(""); + $('#' + that.form_id).append(""); }); $(that.allow_cid).each(function(i,v) { - aclfields.append(""); + $('#' + that.form_id).append(""); }); $(that.deny_gid).each(function(i,v) { - aclfields.append(""); + $('#' + that.form_id).append(""); }); $(that.deny_cid).each(function(i,v) { - aclfields.append(""); + $('#' + that.form_id).append(""); }); //areYouSure jquery plugin: recheck the form here @@ -101,6 +127,7 @@ ACL.prototype.on_onlyme = function(event) { that.deny_cid = []; that.deny_gid = []; + that.update_view(event.target.value); that.on_submit(); @@ -126,14 +153,14 @@ ACL.prototype.on_showlimited = function(event) { // preventDefault() isn't called here as we want state changes from update_view() to be applied to the radiobutton event.stopPropagation(); - if(that.preset[0].length === 0 && that.preset[1].length === 0 && that.preset[2].length === 0 && that.preset[3].length === 0) { - that.preset[0] = [that.self[0]]; + if(that.allow_cid.length === 0 && that.allow_gid.length === 0 && that.deny_cid.length === 0 && that.deny_gid.length === 0) { + that.allow_cid = [that.self[0]]; } - that.allow_cid = (that.preset[0] || []); - that.allow_gid = (that.preset[1] || []); - that.deny_cid = (that.preset[2] || []); - that.deny_gid = (that.preset[3] || []); + that.allow_cid = (that.allow_cid || []); + that.allow_gid = (that.allow_gid || []); + that.deny_cid = (that.deny_cid || []); + that.deny_gid = (that.deny_gid || []); that.update_view(event.target.value); that.on_submit(); @@ -239,14 +266,21 @@ ACL.prototype.set_deny = function(itemid) { that.update_view(); }; -ACL.prototype.update_select = function(preset) { - that.showall.prop('selected', preset === 'public'); - that.onlyme.prop('selected', preset === 'onlyme'); - that.showlimited.prop('selected', preset === 'limited'); +ACL.prototype.update_select = function(set) { + that.showall.prop('selected', set === 'public'); + that.onlyme.prop('selected', set === 'onlyme'); + that.showlimited.prop('selected', set === 'limited'); }; ACL.prototype.update_view = function(value) { + console.log(that.form_id); + + console.log(that.allow_cid); + console.log(that.allow_gid); + console.log(that.deny_cid); + console.log(that.deny_gid); + if (that.allow_gid.length === 0 && that.allow_cid.length === 0 && that.deny_gid.length === 0 && that.deny_cid.length === 0) { that.list.hide(); //hide acl-list that.info.show(); //show acl-info diff --git a/view/tpl/acl_selector.tpl b/view/tpl/acl_selector.tpl index 60fae0a29..ddeb25a39 100755 --- a/view/tpl/acl_selector.tpl +++ b/view/tpl/acl_selector.tpl @@ -1,3 +1,4 @@ +
- +
diff --git a/view/tpl/attach_edit.tpl b/view/tpl/attach_edit.tpl index 965fb4819..1098049bf 100644 --- a/view/tpl/attach_edit.tpl +++ b/view/tpl/attach_edit.tpl @@ -1,4 +1,4 @@ -
+ @@ -16,15 +16,13 @@
- -
- {{$aclselect}} -
+{{$aclselect}} diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl index 490349a04..a207989fb 100755 --- a/view/tpl/jot.tpl +++ b/view/tpl/jot.tpl @@ -1,4 +1,4 @@ -
+ {{$mimeselect}} {{$layoutselect}} {{if $id_select}} @@ -23,7 +23,6 @@ - {{if $showacl}}{{$acl}}{{/if}} {{if $webpage}}
@@ -166,11 +165,11 @@ {{/if}} {{if $showacl}} - {{/if}} - +
@@ -184,6 +183,8 @@ +{{if $showacl}}{{$acl}}{{/if}} + {{if $feature_expire}}
- + {{* album renaming is not supported atm.
@@ -88,8 +88,6 @@
{{/if}} - {{$edit.aclselect}} -
@@ -102,6 +100,7 @@
+ {{$edit.aclselect}}
diff --git a/view/tpl/photos_upload.tpl b/view/tpl/photos_upload.tpl index 6b98a8ac4..90cd0e84a 100755 --- a/view/tpl/photos_upload.tpl +++ b/view/tpl/photos_upload.tpl @@ -1,6 +1,6 @@
-
+
@@ -14,9 +14,6 @@ {{/foreach}}
- - {{$aclselect}} - {{if $default}}
@@ -59,5 +56,6 @@ {{/if}}
+ {{$aclselect}}
-- cgit v1.2.3 From 0340160ba71f73ef3dab1141d75f30d85144cc44 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 4 Aug 2016 10:36:45 +0200 Subject: multi acl: port /cloud and /filestorage --- Zotlabs/Module/Filestorage.php | 11 +++++------ Zotlabs/Storage/Browser.php | 4 ++++ view/js/main.js | 2 -- view/js/mod_filestorage.js | 15 +-------------- view/tpl/attach_edit.tpl | 6 +++--- view/tpl/cloud_actionspanel.tpl | 3 +-- 6 files changed, 14 insertions(+), 27 deletions(-) diff --git a/Zotlabs/Module/Filestorage.php b/Zotlabs/Module/Filestorage.php index c8ad147bb..a401f4822 100644 --- a/Zotlabs/Module/Filestorage.php +++ b/Zotlabs/Module/Filestorage.php @@ -141,7 +141,7 @@ class Filestorage extends \Zotlabs\Web\Controller { // Encode path that is used for link so it's a valid URL // Keep slashes as slashes, otherwise mod_rewrite doesn't work correctly $encoded_path = str_replace('%2F', '/', rawurlencode($cloudpath)); - + $o = replace_macros(get_markup_template('attach_edit.tpl'), array( '$header' => t('Edit file permissions'), '$file' => $f, @@ -151,6 +151,10 @@ class Filestorage extends \Zotlabs\Web\Controller { '$channelnick' => $channel['channel_address'], '$permissions' => t('Permissions'), '$aclselect' => $aclselect_e, + '$allow_cid' => acl2json($f['allow_cid']), + '$allow_gid' => acl2json($f['allow_gid']), + '$deny_cid' => acl2json($f['deny_cid']), + '$deny_gid' => acl2json($f['deny_gid']), '$lockstate' => $lockstate, '$permset' => t('Set/edit permissions'), '$recurse' => array('recurse', t('Include all files and sub folders'), 0, '', array(t('No'), t('Yes'))), @@ -162,11 +166,6 @@ class Filestorage extends \Zotlabs\Web\Controller { '$attach_btn_title' => t('Share this file'), '$link_btn_title' => t('Show URL to this file'), '$notify' => array('notify', t('Notify your contacts about this file'), 0, '', array(t('No'), t('Yes'))), - - '$allow_cid' => json_encode(expand_acl($f['allow_cid'])), - '$allow_gid' => json_encode(expand_acl($f['allow_gid'])), - '$deny_cid' => json_encode(expand_acl($f['deny_cid'])), - '$deny_cid' => json_encode(expand_acl($f['deny_gid'])) )); echo $o; diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php index 93c55bd4c..78b267bf8 100644 --- a/Zotlabs/Storage/Browser.php +++ b/Zotlabs/Storage/Browser.php @@ -324,6 +324,10 @@ class Browser extends DAV\Browser\Plugin { '$quota' => $quota, '$channick' => $this->auth->owner_nick, '$aclselect' => $aclselect, + '$allow_cid' => acl2json($channel_acl['allow_cid']), + '$allow_gid' => acl2json($channel_acl['allow_gid']), + '$deny_cid' => acl2json($channel_acl['deny_cid']), + '$deny_gid' => acl2json($channel_acl['deny_gid']), '$lockstate' => $lockstate, '$return_url' => \App::$cmd, '$dragdroptext' => t('Drop files here to immediately upload') diff --git a/view/js/main.js b/view/js/main.js index a3fade0ea..21157bdfe 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1015,8 +1015,6 @@ function filestorage(event, nick, id) { $('#cloud-index-' + last_filestorage_id).removeClass('cloud-index-active'); $('#perms-panel-' + last_filestorage_id).hide().html(''); $('#file-edit-' + id).spin('tiny'); - // What for do we need this here? - delete acl; $.get('filestorage/' + nick + '/' + id + '/edit', function(data) { $('#cloud-index-' + id).addClass('cloud-index-active'); $('#perms-panel-' + id).html(data).show(); diff --git a/view/js/mod_filestorage.js b/view/js/mod_filestorage.js index c0620c928..4f58af9d5 100644 --- a/view/js/mod_filestorage.js +++ b/view/js/mod_filestorage.js @@ -1,17 +1,4 @@ /** * JavaScript used by mod/filestorage */ -$(document).ready(function() { - $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() { - var selstr; - $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() { - selstr = $(this).text(); - $('#jot-perms-icon').removeClass('fa-unlock').addClass('fa-lock'); - $('#jot-public').hide(); - }); - if(selstr === null) { - $('#jot-perms-icon').removeClass('fa-lock').addClass('fa-unlock'); - $('#jot-public').show(); - } - }).trigger('change'); -}); \ No newline at end of file + diff --git a/view/tpl/attach_edit.tpl b/view/tpl/attach_edit.tpl index 1098049bf..1d58004e5 100644 --- a/view/tpl/attach_edit.tpl +++ b/view/tpl/attach_edit.tpl @@ -1,4 +1,4 @@ -
+ @@ -16,10 +16,10 @@
- -
diff --git a/view/tpl/cloud_actionspanel.tpl b/view/tpl/cloud_actionspanel.tpl index 2c07f5ea7..0884cd0b4 100644 --- a/view/tpl/cloud_actionspanel.tpl +++ b/view/tpl/cloud_actionspanel.tpl @@ -9,10 +9,9 @@
{{if $quota.limit || $quota.used}}{{/if}} - + -
-- cgit v1.2.3 From b49cfb2efd05a46a830238e5dff703086ffc59c4 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 4 Aug 2016 10:46:50 +0200 Subject: multi acl: port /chat --- Zotlabs/Module/Chat.php | 4 ++++ view/tpl/chatroom_new.tpl | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Module/Chat.php b/Zotlabs/Module/Chat.php index ff55a9319..69ab8000a 100644 --- a/Zotlabs/Module/Chat.php +++ b/Zotlabs/Module/Chat.php @@ -234,6 +234,10 @@ class Chat extends \Zotlabs\Web\Controller { '$chat_expire' => array('chat_expire',t('Expiration of chats (minutes)'),120,''), '$permissions' => t('Permissions'), '$acl' => populate_acl($channel_acl,false), + '$allow_cid' => acl2json($channel_acl['allow_cid']), + '$allow_gid' => acl2json($channel_acl['allow_gid']), + '$deny_cid' => acl2json($channel_acl['deny_cid']), + '$deny_gid' => acl2json($channel_acl['deny_gid']), '$lockstate' => $lockstate, '$submit' => t('Submit') diff --git a/view/tpl/chatroom_new.tpl b/view/tpl/chatroom_new.tpl index 94f694e41..1b7e0501a 100644 --- a/view/tpl/chatroom_new.tpl +++ b/view/tpl/chatroom_new.tpl @@ -1,5 +1,5 @@
-
+ {{include file="field_input.tpl" field=$name}} {{include file="field_input.tpl" field=$chat_expire}}
-- cgit v1.2.3 From 120e9a1e4c816eb629bc00dcf2324a26825479e0 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 4 Aug 2016 11:23:43 +0200 Subject: multi acl: port /webpages and /mitem --- Zotlabs/Module/Editwebpage.php | 1 + Zotlabs/Module/Mitem.php | 10 +++++++++- Zotlabs/Module/Webpages.php | 1 + view/tpl/mitemedit.tpl | 4 ++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Module/Editwebpage.php b/Zotlabs/Module/Editwebpage.php index a55f81101..2da8871a2 100644 --- a/Zotlabs/Module/Editwebpage.php +++ b/Zotlabs/Module/Editwebpage.php @@ -151,6 +151,7 @@ class Editwebpage extends \Zotlabs\Web\Controller { 'post_id' => $post_id, 'visitor' => ($is_owner) ? true : false, 'acl' => populate_acl($itm[0],false,\Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')), + 'permissions' => $itm[0], 'showacl' => ($is_owner) ? true : false, 'mimetype' => $mimetype, 'mimeselect' => true, diff --git a/Zotlabs/Module/Mitem.php b/Zotlabs/Module/Mitem.php index b64b50c8e..28f51b81b 100644 --- a/Zotlabs/Module/Mitem.php +++ b/Zotlabs/Module/Mitem.php @@ -147,12 +147,16 @@ class Mitem extends \Zotlabs\Web\Controller { else { $display = (($r) ? 'none' : 'block'); } - + $create = replace_macros(get_markup_template('mitemedit.tpl'), array( '$menu_id' => \App::$data['menu']['menu_id'], '$permissions' => t('Menu Item Permissions'), '$permdesc' => t("\x28click to open/close\x29"), '$aclselect' => populate_acl($acl->get(),false), + '$allow_cid' => acl2json($acl->get()['allow_cid']), + '$allow_gid' => acl2json($acl->get()['allow_gid']), + '$deny_cid' => acl2json($acl->get()['deny_cid']), + '$deny_gid' => acl2json($acl->get()['deny_gid']), '$mitem_desc' => array('mitem_desc', t('Link Name'), '', 'Visible name of the link','*'), '$mitem_link' => array('mitem_link', t('Link or Submenu Target'), '', t('Enter URL of the link or select a menu name to create a submenu'), '*', 'list="menu-names"'), '$usezid' => array('usezid', t('Use magic-auth if available'), true, '', array(t('No'), t('Yes'))), @@ -226,6 +230,10 @@ class Mitem extends \Zotlabs\Web\Controller { '$permissions' => t('Menu Item Permissions'), '$permdesc' => t("\x28click to open/close\x29"), '$aclselect' => populate_acl($mitem,false), + '$allow_cid' => acl2json($mitem['allow_cid']), + '$allow_gid' => acl2json($mitem['allow_gid']), + '$deny_cid' => acl2json($mitem['deny_cid']), + '$deny_gid' => acl2json($mitem['deny_gid']), '$mitem_id' => intval(argv(2)), '$mitem_desc' => array('mitem_desc', t('Link text'), $mitem['mitem_desc'], '','*'), '$mitem_link' => array('mitem_link', t('Link or Submenu Target'), $mitem['mitem_link'], 'Enter URL of the link or select a menu name to create a submenu', '*', 'list="menu-names"'), diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php index d3199f223..0a48d43c6 100644 --- a/Zotlabs/Module/Webpages.php +++ b/Zotlabs/Module/Webpages.php @@ -127,6 +127,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'), 'acl' => (($is_owner) ? populate_acl($channel_acl,false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')) : ''), + 'permissions' => (($is_owner) ? $channel_acl : ''), 'showacl' => (($is_owner) ? true : false), 'visitor' => true, 'hide_location' => true, diff --git a/view/tpl/mitemedit.tpl b/view/tpl/mitemedit.tpl index 865c587ec..a06203244 100644 --- a/view/tpl/mitemedit.tpl +++ b/view/tpl/mitemedit.tpl @@ -5,7 +5,7 @@
{{/if}} - {{$aclselect}}
+ {{$aclselect}}
{{if $header}} -- cgit v1.2.3 From 036b72757c0dd24cb468e5d02f717de9dffe67cb Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 4 Aug 2016 12:09:06 +0200 Subject: multi acl: port /wiki --- Zotlabs/Module/Wiki.php | 17 +++++++++++++---- view/tpl/wiki.tpl | 14 +++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 55a52ea6d..011cd4366 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -74,11 +74,16 @@ class Wiki extends \Zotlabs\Web\Controller { // Initialize the ACL to the channel default permissions $x = array( 'lockstate' => (( $local_observer['channel_allow_cid'] || - $local_observer['channel_allow_gid'] || - $local_observer['channel_deny_cid'] || - $local_observer['channel_deny_gid']) - ? 'lock' : 'unlock'), + $local_observer['channel_allow_gid'] || + $local_observer['channel_deny_cid'] || + $local_observer['channel_deny_gid']) + ? 'lock' : 'unlock' + ), 'acl' => populate_acl($channel_acl), + 'allow_cid' => acl2json($channel_acl['allow_cid']), + 'allow_gid' => acl2json($channel_acl['allow_gid']), + 'deny_cid' => acl2json($channel_acl['deny_cid']), + 'deny_gid' => acl2json($channel_acl['deny_gid']), 'bang' => '' ); } else { @@ -186,6 +191,10 @@ class Wiki extends \Zotlabs\Web\Controller { '$page' => $pageUrlName, '$lockstate' => $x['lockstate'], '$acl' => $x['acl'], + '$allow_cid' => $x['allow_cid'], + '$allow_gid' => $x['allow_gid'], + '$deny_cid' => $x['deny_cid'], + '$deny_gid' => $x['deny_gid'], '$bang' => $x['bang'], '$content' => $content, '$renderedContent' => $renderedContent, diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl index d9a4f8be3..c346bed60 100644 --- a/view/tpl/wiki.tpl +++ b/view/tpl/wiki.tpl @@ -29,7 +29,7 @@
-
+
+
-
-
{{$acl}}
-
-
+ {{$acl}} +
+