Only show the user's groups in the share with autocomplete
This commit is contained in:
parent
7c0a5d4a59
commit
b6b713eb76
1 changed files with 6 additions and 9 deletions
|
@ -100,18 +100,15 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['item']
|
|||
}
|
||||
}
|
||||
$count = 0;
|
||||
$groups = array();
|
||||
$limit = 0;
|
||||
$offset = 0;
|
||||
while ($count < 4 && count($groups) == $limit) {
|
||||
$limit = 4 - $count;
|
||||
$groups = OC_Group::getGroups($_GET['search'], $limit, $offset);
|
||||
$offset += $limit;
|
||||
foreach ($groups as $group) {
|
||||
if (!isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !in_array($group, $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])) {
|
||||
$groups = OC_Group::getUserGroups(OC_User::getUser());
|
||||
foreach ($groups as $group) {
|
||||
if ($count < 4) {
|
||||
if (stripos($group, $_GET['search']) !== false && (!isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !in_array($group, $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]))) {
|
||||
$shareWith[] = array('label' => $group.' (group)', 'value' => array('shareType' => OCP\Share::SHARE_TYPE_GROUP, 'shareWith' => $group));
|
||||
$count++;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
OC_JSON::success(array('data' => $shareWith));
|
||||
|
|
Loading…
Reference in a new issue