diff options
author | Mario <mario@mariovavti.com> | 2021-12-15 12:17:19 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-12-15 12:17:19 +0000 |
commit | 2968bf8241d2969c4d51f1651fc3f8c7688b2fca (patch) | |
tree | db015d27098c546c32f41682e3b7dac2480b890e /Zotlabs/Widget | |
parent | b37165c62b1037e504d4b68a507241acf97ede5e (diff) | |
download | volse-hubzilla-2968bf8241d2969c4d51f1651fc3f8c7688b2fca.tar.gz volse-hubzilla-2968bf8241d2969c4d51f1651fc3f8c7688b2fca.tar.bz2 volse-hubzilla-2968bf8241d2969c4d51f1651fc3f8c7688b2fca.zip |
merge branch perms_ng into dev
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r-- | Zotlabs/Widget/Collections.php | 6 | ||||
-rw-r--r-- | Zotlabs/Widget/Messages.php | 2 | ||||
-rw-r--r-- | Zotlabs/Widget/Permcats.php | 79 | ||||
-rw-r--r-- | Zotlabs/Widget/Profile.php | 10 | ||||
-rw-r--r-- | Zotlabs/Widget/Settings_menu.php | 5 |
5 files changed, 95 insertions, 7 deletions
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 @@ <?php namespace Zotlabs\Widget; - -require_once('include/group.php'); + +use Zotlabs\Lib\AccessList; class Collections { @@ -49,6 +49,6 @@ class Collections { break; } - return group_side($every, $each, $edit, $current, $abook_id, $wmode); + return AccessList::widget($every, $each, $edit, $current, $abook_id, $wmode); } } diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index c0fef9f75..71f4bd310 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -219,7 +219,7 @@ class Messages { $entries[$i]['info'] = ''; $entries[$i]['created'] = datetime_convert('UTC', date_default_timezone_get(), $notice['created']); $entries[$i]['summary'] = $summary; - $entries[$i]['b64mid'] = basename($notice['link']); + $entries[$i]['b64mid'] = (($notice['ntype'] & NOTIFY_INTRO) ? '' : basename($notice['link'])); $entries[$i]['href'] = (($notice['ntype'] & NOTIFY_INTRO) ? $notice['link'] : z_root() . '/hq/' . basename($notice['link'])); $entries[$i]['icon'] = (($notice['ntype'] & NOTIFY_INTRO) ? '<i class="fa fa-user-plus"></i>' : ''); 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 @@ +<?php + +namespace Zotlabs\Widget; + +use Zotlabs\Lib\Permcat; +use Zotlabs\Access\PermissionLimits; + +class Permcats { + + function widget($arr) { + $pcat = new Permcat(local_channel()); + $pcatlist = $pcat->listing(); + + $list = '<b>Roles:</b><br>'; + $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 .= '<a href="permcats/' . bin2hex($pc['name']) . '">' . $pc['localname'] . '</a><br>'; + $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 = '<b>Role members:</b><br>'; + $members .= '<div class="border rounded" style="height: 20rem; overflow: auto;">'; + + foreach ($r as $rr) { + $addr = (($rr['xchan_addr']) ? $rr['xchan_addr'] : $rr['xchan_url']); + $members .= '<a href="connections#' . $rr['abook_id'] . '" class="lh-sm border-bottom p-2 d-block text-truncate"><img src="' . $rr['xchan_photo_s'] . '" class="float-start rounded me-2" style="height: 2.2rem; width: 2.2rem;" loading="lazy">' . $rr['xchan_name'] . '<br><span class="text-muted small">' . $addr . '</span></a>'; + } + $members .= '</div>'; + } + return $list . '<br>' . $members. '<br>' . $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( |