From 2968bf8241d2969c4d51f1651fc3f8c7688b2fca Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 15 Dec 2021 12:17:19 +0000 Subject: merge branch perms_ng into dev --- Zotlabs/Widget/Collections.php | 6 +-- Zotlabs/Widget/Messages.php | 2 +- Zotlabs/Widget/Permcats.php | 79 ++++++++++++++++++++++++++++++++++++++++ Zotlabs/Widget/Profile.php | 10 +++-- Zotlabs/Widget/Settings_menu.php | 5 +++ 5 files changed, 95 insertions(+), 7 deletions(-) create mode 100644 Zotlabs/Widget/Permcats.php (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Collections.php b/Zotlabs/Widget/Collections.php index bc9c812c6..774878540 100644 --- a/Zotlabs/Widget/Collections.php +++ b/Zotlabs/Widget/Collections.php @@ -1,8 +1,8 @@ ' : ''); diff --git a/Zotlabs/Widget/Permcats.php b/Zotlabs/Widget/Permcats.php new file mode 100644 index 000000000..72c80ca0c --- /dev/null +++ b/Zotlabs/Widget/Permcats.php @@ -0,0 +1,79 @@ +listing(); + + $list = 'Roles:
'; + $active = ''; + $active_role = ''; + + if($pcatlist) { + $i = 0; + foreach($pcatlist as $pc) { + if(argc() > 1) { + if($pc['name'] == hex2bin(argv(1))) { + $active = $i; + $active_role = $pc['name']; + } + } + + $list .= '' . $pc['localname'] . '
'; + $i++; + } + } + + if(argc() > 1) { + +/* get role members based on permissions + $test = $pcatlist[$active]['perms']; + + $role_sql = ''; + $count = 0; + foreach ($test as $t) { + $checkinherited = PermissionLimits::Get(local_channel(),$t['name']); + + if($checkinherited & PERMS_SPECIFIC) { + $role_sql .= "( abconfig.k = '" . dbesc($t['name']) . "' AND abconfig.v = '" . intval($t['value']) . "' ) OR "; + $count++; + } + } + + $role_sql = rtrim($role_sql, ' OR '); + + $r = q("SELECT abconfig.xchan, xchan.xchan_name, abook.abook_id FROM abconfig LEFT JOIN xchan on abconfig.xchan = xchan.xchan_hash LEFT JOIN abook ON abconfig.xchan = abook.abook_xchan WHERE xchan.xchan_deleted = 0 and abconfig.chan = %d AND abconfig.cat = 'my_perms' AND ( $role_sql ) GROUP BY abconfig.xchan HAVING count(abconfig.xchan) = %d ORDER BY xchan.xchan_name", + intval(local_channel()), + intval($count) + ); +*/ + + // get role members based on abook_role + + $r = q("SELECT abook.abook_id, abook.abook_role, xchan.xchan_name, xchan.xchan_addr, xchan.xchan_url, xchan.xchan_photo_s FROM abook + LEFT JOIN xchan on abook.abook_xchan = xchan.xchan_hash + WHERE abook.abook_channel = %d AND abook.abook_role = '%s' AND abook_self = 0 AND xchan_deleted = 0 + ORDER BY xchan.xchan_name", + intval(local_channel()), + dbesc($active_role) + ); + + $members = 'Role members:
'; + $members .= '
'; + + foreach ($r as $rr) { + $addr = (($rr['xchan_addr']) ? $rr['xchan_addr'] : $rr['xchan_url']); + $members .= '' . $rr['xchan_name'] . '
' . $addr . '
'; + } + $members .= '
'; + } + return $list . '
' . $members. '
' . $others; + + } +} diff --git a/Zotlabs/Widget/Profile.php b/Zotlabs/Widget/Profile.php index 8bd624c0f..0e5444a56 100644 --- a/Zotlabs/Widget/Profile.php +++ b/Zotlabs/Widget/Profile.php @@ -2,12 +2,16 @@ namespace Zotlabs\Widget; +use App; class Profile { - function widget($args) { + if(!App::$profile['profile_uid']) { + return; + } + $block = observer_prohibited(); - return profile_sidebar(\App::$profile, $block, true, false); - } + return profile_sidebar(App::$profile, $block, true, false); + } } diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php index 25b80a4b4..4d0f1d2dd 100644 --- a/Zotlabs/Widget/Settings_menu.php +++ b/Zotlabs/Widget/Settings_menu.php @@ -40,6 +40,11 @@ class Settings_menu { 'selected' => ((argv(1) === 'channel') ? 'active' : ''), ), + array( + 'label' => t('Privacy settings'), + 'url' => z_root().'/settings/privacy', + 'selected' => ((argv(1) === 'privacy') ? 'active' : '') + ) ); $tabs[] = array( -- cgit v1.2.3