defperm app
This commit is contained in:
parent
d0605e8d5f
commit
c00dc6120d
@ -271,6 +271,10 @@ class Apps {
|
|||||||
if(! can_view_public_stream())
|
if(! can_view_public_stream())
|
||||||
unset($ret);
|
unset($ret);
|
||||||
break;
|
break;
|
||||||
|
case 'custom_role':
|
||||||
|
if(get_pconfig(local_channel(),'system','permissions_role') != 'custom')
|
||||||
|
unset($ret);
|
||||||
|
break;
|
||||||
case 'observer':
|
case 'observer':
|
||||||
if(! $observer)
|
if(! $observer)
|
||||||
unset($ret);
|
unset($ret);
|
||||||
@ -468,6 +472,10 @@ class Apps {
|
|||||||
if(! can_view_public_stream())
|
if(! can_view_public_stream())
|
||||||
return '';
|
return '';
|
||||||
break;
|
break;
|
||||||
|
case 'custom_role':
|
||||||
|
if(get_pconfig(local_channel(),'system','permissions_role') != 'custom')
|
||||||
|
return '';
|
||||||
|
break;
|
||||||
case 'observer':
|
case 'observer':
|
||||||
$observer = \App::get_observer();
|
$observer = \App::get_observer();
|
||||||
if(! $observer)
|
if(! $observer)
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Zotlabs\Module;
|
namespace Zotlabs\Module;
|
||||||
|
|
||||||
|
use App;
|
||||||
use Zotlabs\Lib\Apps;
|
use Zotlabs\Lib\Apps;
|
||||||
|
use Zotlabs\Web\Controller;
|
||||||
|
|
||||||
require_once('include/socgraph.php');
|
require_once('include/socgraph.php');
|
||||||
require_once('include/selectors.php');
|
require_once('include/selectors.php');
|
||||||
require_once('include/group.php');
|
require_once('include/group.php');
|
||||||
require_once('include/photos.php');
|
require_once('include/photos.php');
|
||||||
|
|
||||||
|
class Defperms extends Controller {
|
||||||
class Defperms extends \Zotlabs\Web\Controller {
|
|
||||||
|
|
||||||
/* @brief Initialize the connection-editor
|
/* @brief Initialize the connection-editor
|
||||||
*
|
*
|
||||||
@ -21,16 +22,19 @@ class Defperms extends \Zotlabs\Web\Controller {
|
|||||||
if(! local_channel())
|
if(! local_channel())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(! Apps::system_app_installed(local_channel(), 'Default Permissions'))
|
||||||
|
return;
|
||||||
|
|
||||||
$r = q("SELECT abook.*, xchan.*
|
$r = q("SELECT abook.*, xchan.*
|
||||||
FROM abook left join xchan on abook_xchan = xchan_hash
|
FROM abook left join xchan on abook_xchan = xchan_hash
|
||||||
WHERE abook_self = 1 and abook_channel = %d LIMIT 1",
|
WHERE abook_self = 1 and abook_channel = %d LIMIT 1",
|
||||||
intval(local_channel())
|
intval(local_channel())
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
\App::$poi = $r[0];
|
App::$poi = $r[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$channel = \App::get_channel();
|
$channel = App::get_channel();
|
||||||
if($channel)
|
if($channel)
|
||||||
head_set_icon($channel['xchan_photo_s']);
|
head_set_icon($channel['xchan_photo_s']);
|
||||||
}
|
}
|
||||||
@ -45,11 +49,14 @@ class Defperms extends \Zotlabs\Web\Controller {
|
|||||||
if(! local_channel())
|
if(! local_channel())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(! Apps::system_app_installed(local_channel(), 'Default Permissions'))
|
||||||
|
return;
|
||||||
|
|
||||||
$contact_id = intval(argv(1));
|
$contact_id = intval(argv(1));
|
||||||
if(! $contact_id)
|
if(! $contact_id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$channel = \App::get_channel();
|
$channel = App::get_channel();
|
||||||
|
|
||||||
$orig_record = q("SELECT * FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1",
|
$orig_record = q("SELECT * FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1",
|
||||||
intval($contact_id),
|
intval($contact_id),
|
||||||
@ -113,7 +120,7 @@ class Defperms extends \Zotlabs\Web\Controller {
|
|||||||
intval($contact_id)
|
intval($contact_id)
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
\App::$poi = $r[0];
|
App::$poi = $r[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -132,22 +139,22 @@ class Defperms extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
function defperms_clone(&$a) {
|
function defperms_clone(&$a) {
|
||||||
|
|
||||||
if(! \App::$poi)
|
if(! App::$poi)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$channel = \App::get_channel();
|
$channel = App::get_channel();
|
||||||
|
|
||||||
$r = q("SELECT abook.*, xchan.*
|
$r = q("SELECT abook.*, xchan.*
|
||||||
FROM abook left join xchan on abook_xchan = xchan_hash
|
FROM abook left join xchan on abook_xchan = xchan_hash
|
||||||
WHERE abook_channel = %d and abook_id = %d LIMIT 1",
|
WHERE abook_channel = %d and abook_id = %d LIMIT 1",
|
||||||
intval(local_channel()),
|
intval(local_channel()),
|
||||||
intval(\App::$poi['abook_id'])
|
intval(App::$poi['abook_id'])
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
\App::$poi = array_shift($r);
|
App::$poi = array_shift($r);
|
||||||
}
|
}
|
||||||
|
|
||||||
$clone = \App::$poi;
|
$clone = App::$poi;
|
||||||
|
|
||||||
unset($clone['abook_id']);
|
unset($clone['abook_id']);
|
||||||
unset($clone['abook_account']);
|
unset($clone['abook_account']);
|
||||||
@ -175,8 +182,17 @@ class Defperms extends \Zotlabs\Web\Controller {
|
|||||||
return login();
|
return login();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(! Apps::system_app_installed(local_channel(), 'Default Permissions')) {
|
||||||
|
//Do not display any associated widgets at this point
|
||||||
|
App::$pdl = '';
|
||||||
|
|
||||||
|
$o = '<b>' . t('Default Permissions App') . ' (' . t('Not Installed') . '):</b><br>';
|
||||||
|
$o .= t('Set custom default permissions for new connections');
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
$section = ((array_key_exists('section',$_REQUEST)) ? $_REQUEST['section'] : '');
|
$section = ((array_key_exists('section',$_REQUEST)) ? $_REQUEST['section'] : '');
|
||||||
$channel = \App::get_channel();
|
$channel = App::get_channel();
|
||||||
|
|
||||||
$yes_no = array(t('No'),t('Yes'));
|
$yes_no = array(t('No'),t('Yes'));
|
||||||
|
|
||||||
@ -194,7 +210,7 @@ class Defperms extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
$o .= " }\n</script>\n";
|
$o .= " }\n</script>\n";
|
||||||
|
|
||||||
if(\App::$poi) {
|
if(App::$poi) {
|
||||||
|
|
||||||
$sections = [];
|
$sections = [];
|
||||||
|
|
||||||
@ -204,9 +220,9 @@ class Defperms extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
|
|
||||||
$perms = array();
|
$perms = array();
|
||||||
$channel = \App::get_channel();
|
$channel = App::get_channel();
|
||||||
|
|
||||||
$contact = \App::$poi;
|
$contact = App::$poi;
|
||||||
|
|
||||||
$global_perms = \Zotlabs\Access\Permissions::Perms();
|
$global_perms = \Zotlabs\Access\Permissions::Perms();
|
||||||
|
|
||||||
|
@ -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");
|
$tabtpl = get_markup_template("generic_links_widget.tpl");
|
||||||
return replace_macros($tabtpl, array(
|
return replace_macros($tabtpl, array(
|
||||||
'$title' => t('Settings'),
|
'$title' => t('Settings'),
|
||||||
|
Reference in New Issue
Block a user