use new cache functionality for finding possible new memberUIDs
This commit is contained in:
parent
4211e548da
commit
fca21dbdf8
|
@ -205,24 +205,18 @@ class posixGroup extends baseModule {
|
||||||
*/
|
*/
|
||||||
function display_html_user(&$post) {
|
function display_html_user(&$post) {
|
||||||
// load list with all users
|
// load list with all users
|
||||||
$dn_users = $_SESSION['cache']->get_cache('uid', 'posixAccount', 'user');
|
$dn_users = $_SESSION['cache']->get_cache(array('uid', 'gidNumber'), 'posixAccount', 'user');
|
||||||
|
$users = array();
|
||||||
if (is_array($dn_users)) {
|
if (is_array($dn_users)) {
|
||||||
foreach ($dn_users as $user) $users[] = $user[0];
|
$DNs = array_keys($dn_users);
|
||||||
// sort users
|
for ($i = 0; $i < sizeof($DNs); $i++) {
|
||||||
sort($users, SORT_STRING);
|
// users who can be added have a uid and gidNumber
|
||||||
// remove users which are already members
|
if (isset($dn_users[$DNs[$i]]['uid'][0]) && isset($dn_users[$DNs[$i]]['gidNumber'][0]) &&
|
||||||
$users = array_delete($this->attributes['memberUid'], $users);
|
// are not already member
|
||||||
// remove users with this group as their primary group
|
!in_array($dn_users[$DNs[$i]]['uid'][0], $this->attributes['memberUid']) &&
|
||||||
$users_dn = $_SESSION['cache']->get_cache('gidNumber', 'posixAccount', 'user');
|
// and do not have this group as their primary group
|
||||||
$DNs = array_keys($users_dn);
|
!($this->attributes['gidNumber'][0] == $dn_users[$DNs[$i]]['gidNumber'][0])) {
|
||||||
for ($i=0; $i<count($DNs); $i++) {
|
$users[] = $dn_users[$DNs[$i]]['uid'][0];
|
||||||
if ($users_dn[$DNs[$i]][0]==$this->attributes['gidNumber'][0]) {
|
|
||||||
$thisuser = substr($DNs[$i], 4, strpos($DNs[$i], ",")-4);
|
|
||||||
if (in_array($thisuser, $users)) {
|
|
||||||
$users = @array_flip($users);
|
|
||||||
unset($users[$thisuser]);
|
|
||||||
$users = @array_flip($users);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// sort users
|
// sort users
|
||||||
|
|
Loading…
Reference in New Issue