From b415533dd5f9135265d29136d0381eadb7254de6 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Mon, 3 Dec 2007 15:01:45 +0000 Subject: [PATCH] fixes #21 * sort and unify group lists at display and save time * autocompletion only yields groups that are not assigned yet --- admin/directories.php | 9 ++++++--- admin/getgroups.php | 3 ++- admin/users.php | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/admin/directories.php b/admin/directories.php index 792511e..7e5314b 100644 --- a/admin/directories.php +++ b/admin/directories.php @@ -62,7 +62,8 @@ function getDirGroupsFromHtaccess($dirname) { $grouparr = explode(" ", $matches[1][0]); foreach ($grouparr as $group) { $group = trim($group); - if (!in_array($group, $GLOBALS['mandatorygroups'])) { + if (!in_array($group, $GLOBALS['mandatorygroups']) && + !in_array($group, $groups)) { array_push($groups, $group); } } @@ -182,6 +183,8 @@ function setGroups($dirname, &$groups) { array_push($groups, $mgroup); } } + $groups = array_unique($groups); + asort($groups); $found = false; $lines = array(); $found = false; @@ -215,7 +218,7 @@ function setGroups($dirname, &$groups) { * Updates a directory to be accessible by the given list of * 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 */ 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 * 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) { global $davconfig; diff --git a/admin/getgroups.php b/admin/getgroups.php index 7ce865a..aaac4f2 100644 --- a/admin/getgroups.php +++ b/admin/getgroups.php @@ -52,7 +52,8 @@ function getGroups($part) { foreach ($groups as $line) { list($group, $users) = explode(":", $line); $group = trim($group); - if (stripos($group, $last_string) === 0) { + if (!in_array($group, $array) && + (stripos($group, $last_string) === 0)) { $retval[$prefix . $group] = $group; } } diff --git a/admin/users.php b/admin/users.php index 37aa714..6bdbf25 100644 --- a/admin/users.php +++ b/admin/users.php @@ -50,6 +50,7 @@ function _getGroupNames($username) { } } } + asort($retval); return $retval; }