do not list users/groups in select menu which already has an access right

This commit is contained in:
Uwe Steinmann 2019-04-03 10:54:04 +02:00
parent 539b5d3223
commit 9a5d6c31ab

View File

@ -189,11 +189,16 @@ $(document).ready( function() {
<input type="Hidden" name="documentid" value="<?php print $document->getId()?>">
<input type="Hidden" name="action" value="addaccess">
<?php
$memusers = array();
foreach ($accessList["users"] as $userAccess) {
$userObj = $userAccess->getUser();
$memusers[] = $userObj->getID();
}
$options = array();
$options[] = array(-1, getMLText('select_one'));
foreach ($allUsers as $currUser) {
if (!$currUser->isGuest())
$options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin()), ($currUser->getID()==$user->getID()), array(array('data-subtitle', htmlspecialchars($currUser->getFullName()))));
if (!$currUser->isGuest() && !in_array($currUser->getID(), $memusers))
$options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin()), false, array(array('data-subtitle', htmlspecialchars($currUser->getFullName()))));
}
$this->formField(
getMLText("user"),
@ -204,10 +209,16 @@ $(document).ready( function() {
'options'=>$options
)
);
$memgroups = array();
foreach ($accessList["groups"] as $groupAccess) {
$groupObj = $groupAccess->getGroup();
$memgroups[] = $groupObj->getID();
}
$options = array();
$options[] = array(-1, getMLText('select_one'));
foreach ($allGroups as $groupObj) {
$options[] = array($groupObj->getID(), htmlspecialchars($groupObj->getName()));
if(!in_array($groupObj->getID(), $memgroups))
$options[] = array($groupObj->getID(), htmlspecialchars($groupObj->getName()));
}
$this->formField(
getMLText("group"),