* sort and unify group lists at display and save time
 * autocompletion only yields groups that are not assigned yet
This commit is contained in:
Jan Dittberner 2007-12-03 15:01:45 +00:00
parent 0993d2be3a
commit b415533dd5
3 changed files with 9 additions and 4 deletions

View file

@ -62,7 +62,8 @@ function getDirGroupsFromHtaccess($dirname) {
$grouparr = explode(" ", $matches[1][0]); $grouparr = explode(" ", $matches[1][0]);
foreach ($grouparr as $group) { foreach ($grouparr as $group) {
$group = trim($group); $group = trim($group);
if (!in_array($group, $GLOBALS['mandatorygroups'])) { if (!in_array($group, $GLOBALS['mandatorygroups']) &&
!in_array($group, $groups)) {
array_push($groups, $group); array_push($groups, $group);
} }
} }
@ -182,6 +183,8 @@ function setGroups($dirname, &$groups) {
array_push($groups, $mgroup); array_push($groups, $mgroup);
} }
} }
$groups = array_unique($groups);
asort($groups);
$found = false; $found = false;
$lines = array(); $lines = array();
$found = false; $found = false;
@ -215,7 +218,7 @@ function setGroups($dirname, &$groups) {
* Updates a directory to be accessible by the given list of * Updates a directory to be accessible by the given list of
* groups. The directory is created if it doesn't exist. * groups. The directory is created if it doesn't exist.
* *
* @param string $dirname directory name relative to {@link $davconfig['dav.dir']} * @param string $dirname directory name relative to $davconfig['dav.dir']
* @param array $groups a list of group names * @param array $groups a list of group names
*/ */
function updateDirectory($dirname, $groups) { function updateDirectory($dirname, $groups) {
@ -262,7 +265,7 @@ function delrecursive($fullname) {
* Deletes the given directory if it has a valid name and is not the * Deletes the given directory if it has a valid name and is not the
* administration interface directory. * administration interface directory.
* *
* @param string $dirname directory name relative to {@link $davconfig['dav.dir']} * @param string $dirname directory name relative to $davconfig['dav.dir']
*/ */
function deleteDirectory($dirname) { function deleteDirectory($dirname) {
global $davconfig; global $davconfig;

View file

@ -52,7 +52,8 @@ function getGroups($part) {
foreach ($groups as $line) { foreach ($groups as $line) {
list($group, $users) = explode(":", $line); list($group, $users) = explode(":", $line);
$group = trim($group); $group = trim($group);
if (stripos($group, $last_string) === 0) { if (!in_array($group, $array) &&
(stripos($group, $last_string) === 0)) {
$retval[$prefix . $group] = $group; $retval[$prefix . $group] = $group;
} }
} }

View file

@ -50,6 +50,7 @@ function _getGroupNames($username) {
} }
} }
} }
asort($retval);
return $retval; return $retval;
} }