aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-09-26 22:02:50 +0200
committerMario Vavti <mario@mariovavti.com>2018-09-26 22:02:50 +0200
commita7948d7bfee1c0c8c9f1a731aabdc636c280bff0 (patch)
tree16ed302c1fc01084f8e8c9f790494d3b4762b567
parent505782f224d232acd57f7a5986adfc9bf8a7bb79 (diff)
downloadvolse-hubzilla-a7948d7bfee1c0c8c9f1a731aabdc636c280bff0.tar.gz
volse-hubzilla-a7948d7bfee1c0c8c9f1a731aabdc636c280bff0.tar.bz2
volse-hubzilla-a7948d7bfee1c0c8c9f1a731aabdc636c280bff0.zip
permcats app
-rw-r--r--Zotlabs/Module/Connedit.php3
-rw-r--r--Zotlabs/Module/Defperms.php3
-rw-r--r--Zotlabs/Module/Permcats.php (renamed from Zotlabs/Module/Settings/Permcats.php)37
-rw-r--r--Zotlabs/Widget/Settings_menu.php8
-rw-r--r--app/permcats.apd6
-rw-r--r--include/features.php9
-rwxr-xr-xview/tpl/abook_edit.tpl2
-rwxr-xr-xview/tpl/defperms.tpl2
-rw-r--r--view/tpl/permcats.tpl (renamed from view/tpl/settings_permcats.tpl)6
9 files changed, 41 insertions, 35 deletions
diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php
index 712215bc3..3d7ee449a 100644
--- a/Zotlabs/Module/Connedit.php
+++ b/Zotlabs/Module/Connedit.php
@@ -7,6 +7,7 @@ namespace Zotlabs\Module;
*
*/
+use Zotlabs\Lib\Apps;
require_once('include/socgraph.php');
require_once('include/selectors.php');
@@ -851,7 +852,7 @@ class Connedit extends \Zotlabs\Web\Controller {
'$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), t('Connection requests will be approved without your interaction'), $yes_no),
'$permcat' => [ 'permcat', t('Permission role'), '', '<span class="loading invisible">' . t('Loading') . '<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span></span>',$permcats ],
'$permcat_new' => t('Add permission role'),
- '$permcat_enable' => feature_enabled(local_channel(),'permcats'),
+ '$permcat_enable' => Apps::system_app_installed(local_channel(), 'Permission Categories'),
'$addr' => unpunify($contact['xchan_addr']),
'$primeurl' => unpunify($contact['xchan_url']),
'$section' => $section,
diff --git a/Zotlabs/Module/Defperms.php b/Zotlabs/Module/Defperms.php
index 63acc9795..2e886aa64 100644
--- a/Zotlabs/Module/Defperms.php
+++ b/Zotlabs/Module/Defperms.php
@@ -1,6 +1,7 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Lib\Apps;
require_once('include/socgraph.php');
require_once('include/selectors.php');
@@ -238,7 +239,7 @@ class Defperms extends \Zotlabs\Web\Controller {
'$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), t('If enabled, connection requests will be approved without your interaction'), $yes_no),
'$permcat' => [ 'permcat', t('Permission role'), '', '<span class="loading invisible">' . t('Loading') . '<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span></span>',$permcats ],
'$permcat_new' => t('Add permission role'),
- '$permcat_enable' => feature_enabled(local_channel(),'permcats'),
+ '$permcat_enable' => Apps::system_app_installed(local_channel(), 'Permission Categories'),
'$section' => $section,
'$sections' => $sections,
'$autolbl' => t('The permissions indicated on this page will be applied to all new connections.'),
diff --git a/Zotlabs/Module/Settings/Permcats.php b/Zotlabs/Module/Permcats.php
index 40641c3f2..97090067b 100644
--- a/Zotlabs/Module/Settings/Permcats.php
+++ b/Zotlabs/Module/Permcats.php
@@ -1,19 +1,25 @@
<?php
-namespace Zotlabs\Module\Settings;
+namespace Zotlabs\Module;
+use App;
+use Zotlabs\Web\Controller;
+use Zotlabs\Lib\Apps;
-
-class Permcats {
+class Permcats extends Controller {
function post() {
if(! local_channel())
return;
- $channel = \App::get_channel();
+ if(! Apps::system_app_installed(local_channel(), 'Permission Categories'))
+ return
+
+
+ $channel = App::get_channel();
- check_form_security_token_redirectOnErr('/settings/permcats', 'settings_permcats');
+ check_form_security_token_redirectOnErr('/permcats', 'permcats');
$all_perms = \Zotlabs\Access\Permissions::Perms();
@@ -50,13 +56,22 @@ class Permcats {
if(! local_channel())
return;
- $channel = \App::get_channel();
+ if(! Apps::system_app_installed(local_channel(), 'Permission Categories')) {
+ //Do not display any associated widgets at this point
+ App::$pdl = '';
+
+ $o = '<b>Permission Categories App (Not Installed):</b><br>';
+ $o .= t('Create custom connection permission limits');
+ return $o;
+ }
+
+ $channel = App::get_channel();
- if(argc() > 2)
- $name = hex2bin(argv(2));
+ if(argc() > 1)
+ $name = hex2bin(argv(1));
- if(argc() > 3 && argv(3) === 'drop') {
+ if(argc() > 2 && argv(2) === 'drop') {
\Zotlabs\Lib\Permcat::delete(local_channel(),$name);
build_sync_packet();
json_return_and_die([ 'success' => true ]);
@@ -93,9 +108,9 @@ class Permcats {
- $tpl = get_markup_template("settings_permcats.tpl");
+ $tpl = get_markup_template("permcats.tpl");
$o .= replace_macros($tpl, array(
- '$form_security_token' => get_form_security_token("settings_permcats"),
+ '$form_security_token' => get_form_security_token("permcats"),
'$title' => t('Permission Categories'),
'$desc' => $desc,
'$desc2' => $desc2,
diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php
index 041ca312f..781f3b145 100644
--- a/Zotlabs/Widget/Settings_menu.php
+++ b/Zotlabs/Widget/Settings_menu.php
@@ -87,14 +87,6 @@ class Settings_menu {
);
}
- if(feature_enabled(local_channel(),'permcats')) {
- $tabs[] = array(
- 'label' => t('Permission Categories'),
- 'url' => z_root() . '/settings/permcats',
- 'selected' => ((argv(1) === 'permcats') ? 'active' : ''),
- );
- }
-
if($role === false || $role === 'custom') {
$tabs[] = array(
'label' => t('Connection Default Permissions'),
diff --git a/app/permcats.apd b/app/permcats.apd
new file mode 100644
index 000000000..6a961b87e
--- /dev/null
+++ b/app/permcats.apd
@@ -0,0 +1,6 @@
+version: 1
+url: $baseurl/permcats
+requires: local_channel
+name: Permission Categories
+photo: icon:unlock-alt
+categories: Access Control
diff --git a/include/features.php b/include/features.php
index 46f19fc50..a264ae289 100644
--- a/include/features.php
+++ b/include/features.php
@@ -75,15 +75,6 @@ function get_features($filtered = true, $level = (-1)) {
t('Access Control and Permissions'),
[
- 'permcats',
- t('Permission Categories'),
- t('Create custom connection permission limits'),
- false,
- get_config('feature_lock','permcats'),
- feature_level('permcats',2),
- ],
-
- [
'access_tokens',
t('Access Tokens'),
t('Create access tokens so that non-members can access private content.'),
diff --git a/view/tpl/abook_edit.tpl b/view/tpl/abook_edit.tpl
index d72258fa0..6ff7bffcd 100755
--- a/view/tpl/abook_edit.tpl
+++ b/view/tpl/abook_edit.tpl
@@ -485,7 +485,7 @@
</div>
{{if $permcat_enable}}
- <a href="settings/permcats" class="pull-right"><i class="fa fa-plus"></i>&nbsp;{{$permcat_new}}</a>
+ <a href="permcats" class="pull-right"><i class="fa fa-plus"></i>&nbsp;{{$permcat_new}}</a>
{{include file="field_select.tpl" field=$permcat}}
{{/if}}
diff --git a/view/tpl/defperms.tpl b/view/tpl/defperms.tpl
index 5273ee91b..29f642cff 100755
--- a/view/tpl/defperms.tpl
+++ b/view/tpl/defperms.tpl
@@ -17,7 +17,7 @@
<p>{{$permnote_self}}</p>
</div>
{{if $permcat_enable}}
- <a href="settings/permcats" class="pull-right"><i class="fa fa-plus"></i>&nbsp;{{$permcat_new}}</a>
+ <a href="permcats" class="pull-right"><i class="fa fa-plus"></i>&nbsp;{{$permcat_new}}</a>
{{include file="field_select.tpl" field=$permcat}}
{{/if}}
diff --git a/view/tpl/settings_permcats.tpl b/view/tpl/permcats.tpl
index bbbd41669..2cad2db5b 100644
--- a/view/tpl/settings_permcats.tpl
+++ b/view/tpl/permcats.tpl
@@ -8,7 +8,7 @@
{{$desc}}
</div>
- <form action="settings/permcats" id="settings-permcats-form" method="post" autocomplete="off" >
+ <form action="permcats" id="settings-permcats-form" method="post" autocomplete="off" >
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
{{include file="field_input.tpl" field=$name}}
@@ -50,8 +50,8 @@
<table id="permcat-index">
{{foreach $permcats as $k => $v}}
<tr class="permcat-row-{{$k}}">
- <td width="99%"><a href="settings/permcats/{{$k}}">{{$v}}</a></td>
- <td width="1%"><i class="fa fa-trash-o drop-icons" onClick="dropItem('/settings/permcats/{{$k}}/drop', '.permcat-row-{{$k}}')"></i></td>
+ <td width="99%"><a href="permcats/{{$k}}">{{$v}}</a></td>
+ <td width="1%"><i class="fa fa-trash-o drop-icons" onClick="dropItem('permcats/{{$k}}/drop', '.permcat-row-{{$k}}')"></i></td>
</tr>
{{/foreach}}
</table>