From c00dc6120d5a458a2386ab4e561437d9f8c62b3c Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 4 Oct 2018 13:26:45 +0200 Subject: defperm app --- Zotlabs/Lib/Apps.php | 8 +++++++ Zotlabs/Module/Defperms.php | 46 +++++++++++++++++++++++++++------------- Zotlabs/Widget/Settings_menu.php | 8 ------- 3 files changed, 39 insertions(+), 23 deletions(-) diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index ec1f3f9dc..8db4e000f 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -271,6 +271,10 @@ class Apps { if(! can_view_public_stream()) unset($ret); break; + case 'custom_role': + if(get_pconfig(local_channel(),'system','permissions_role') != 'custom') + unset($ret); + break; case 'observer': if(! $observer) unset($ret); @@ -468,6 +472,10 @@ class Apps { if(! can_view_public_stream()) return ''; break; + case 'custom_role': + if(get_pconfig(local_channel(),'system','permissions_role') != 'custom') + return ''; + break; case 'observer': $observer = \App::get_observer(); if(! $observer) diff --git a/Zotlabs/Module/Defperms.php b/Zotlabs/Module/Defperms.php index 2e886aa64..463ecb57a 100644 --- a/Zotlabs/Module/Defperms.php +++ b/Zotlabs/Module/Defperms.php @@ -1,15 +1,16 @@ ' . t('Default Permissions App') . ' (' . t('Not Installed') . '):
'; + $o .= t('Set custom default permissions for new connections'); + return $o; + } $section = ((array_key_exists('section',$_REQUEST)) ? $_REQUEST['section'] : ''); - $channel = \App::get_channel(); + $channel = App::get_channel(); $yes_no = array(t('No'),t('Yes')); @@ -194,7 +210,7 @@ class Defperms extends \Zotlabs\Web\Controller { } $o .= " }\n\n"; - if(\App::$poi) { + if(App::$poi) { $sections = []; @@ -204,9 +220,9 @@ class Defperms extends \Zotlabs\Web\Controller { $perms = array(); - $channel = \App::get_channel(); + $channel = App::get_channel(); - $contact = \App::$poi; + $contact = App::$poi; $global_perms = \Zotlabs\Access\Permissions::Perms(); diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php index 194c4b05b..a4b288441 100644 --- a/Zotlabs/Widget/Settings_menu.php +++ b/Zotlabs/Widget/Settings_menu.php @@ -65,14 +65,6 @@ class Settings_menu { ); } - if($role === false || $role === 'custom') { - $tabs[] = array( - 'label' => t('Connection Default Permissions'), - 'url' => z_root() . '/defperms', - 'selected' => '' - ); - } - $tabtpl = get_markup_template("generic_links_widget.tpl"); return replace_macros($tabtpl, array( '$title' => t('Settings'), -- cgit v1.2.3