testing and bug fixes virtual profile groups
This commit is contained in:
parent
ccdfbc721f
commit
2a52592292
@ -32,10 +32,10 @@ class Lockview extends \Zotlabs\Web\Controller {
|
||||
if(! $item_id)
|
||||
killme();
|
||||
|
||||
if (!in_array($type, array('item','photo','event', 'menu_item', 'chatroom')))
|
||||
if (! in_array($type, array('item', 'photo', 'attach', 'event', 'menu_item', 'chatroom')))
|
||||
killme();
|
||||
|
||||
//we have different naming in in menu_item table and chatroom table
|
||||
// we have different naming in in menu_item table and chatroom table
|
||||
switch($type) {
|
||||
case 'menu_item':
|
||||
$id = 'mitem_id';
|
||||
@ -101,6 +101,22 @@ class Lockview extends \Zotlabs\Web\Controller {
|
||||
stringify_array_elms($deny_groups,true);
|
||||
stringify_array_elms($deny_users,true);
|
||||
|
||||
|
||||
$profile_groups = [];
|
||||
if($allowed_groups) {
|
||||
foreach($allowed_groups as $g) {
|
||||
if(substr($g,0,4) === '\'vp.') {
|
||||
$profile_groups[] = '\'' . substr($g,4);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(count($profile_groups)) {
|
||||
$r = q("SELECT profile_name FROM profile WHERE profile_guid IN ( " . implode(', ', $profile_groups) . " )");
|
||||
if($r)
|
||||
foreach($r as $rr)
|
||||
$l[] = '<li><b>' . t('Profile','acl') . ' ' . $rr['profile_name'] . '</b></li>';
|
||||
}
|
||||
|
||||
if(count($allowed_groups)) {
|
||||
$r = q("SELECT gname FROM groups WHERE hash IN ( " . implode(', ', $allowed_groups) . " )");
|
||||
if($r)
|
||||
@ -120,6 +136,25 @@ class Lockview extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$profile_groups = [];
|
||||
if($deny_groups) {
|
||||
foreach($deny_groups as $g) {
|
||||
if(substr($g,0,4) === '\'vp.') {
|
||||
$profile_groups[] = '\'' . substr($g,4);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(count($profile_groups)) {
|
||||
$r = q("SELECT profile_name FROM profile WHERE profile_guid IN ( " . implode(', ', $profile_groups) . " )");
|
||||
if($r)
|
||||
foreach($r as $rr)
|
||||
$l[] = '<li><b><strike>' . t('Profile','acl') . ' ' . $rr['profile_name'] . '</strike></b></li>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(count($deny_groups)) {
|
||||
$r = q("SELECT gname FROM groups WHERE hash IN ( " . implode(', ', $deny_groups) . " )");
|
||||
if($r)
|
||||
|
@ -174,6 +174,16 @@ function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_descripti
|
||||
$custom = false;
|
||||
}
|
||||
|
||||
$r = q("SELECT id, profile_guid, profile_name from profile where is_default = 0 and uid = %d order by profile_name",
|
||||
intval(local_channel())
|
||||
);
|
||||
if($r) {
|
||||
foreach($r as $rv) {
|
||||
$selected = (($single_group && 'vp.' . $rr['hash'] === $allow_gid[0]) ? ' selected = "selected" ' : '');
|
||||
$groups .= '<option id="' . 'vp' . $rv['id'] . '" value="' . 'vp.' . $rv['profile_guid'] . '"' . $selected . '>' . t('Profile','acl') . ' ' . $rv['profile_name'] . '</option>' . "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
$r = q("SELECT id, hash, gname FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
|
||||
intval(local_channel())
|
||||
);
|
||||
|
@ -750,14 +750,14 @@ function photo_profile_setperms($channel_id,$resource_id,$profile_id) {
|
||||
else {
|
||||
$r = q("update photo set allow_cid = '', allow_gid = '%s', deny_cid = '', deny_gid = ''
|
||||
where resource_id = '%s' and uid = %d",
|
||||
dbesc('vp.' . $profile_guid),
|
||||
dbesc('<vp.' . $profile_guid . '>'),
|
||||
dbesc($resource_id),
|
||||
intval($channel_id)
|
||||
);
|
||||
|
||||
$r = q("update attach set allow_cid = '', allow_gid = '%s', deny_cid = '', deny_gid = ''
|
||||
where hash = '%s' and uid = %d",
|
||||
dbesc('vp.' . $profile_guid),
|
||||
dbesc('<vp.' . $profile_guid . '>'),
|
||||
dbesc($resource_id),
|
||||
intval($channel_id)
|
||||
);
|
||||
|
Reference in New Issue
Block a user