From 00d910288761d8d7ab25f41b32bda26e62c2a21c Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 23 Jan 2006 07:47:41 +0000 Subject: [PATCH] some speed improvements for grop/posix git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2539 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/groups/class_groupManagement.inc | 51 +++-------------- plugins/personal/posix/class_posixAccount.inc | 56 +++++++++++++++++-- plugins/personal/posix/posix_groups.tpl | 7 --- 3 files changed, 60 insertions(+), 54 deletions(-) diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc index 83d6a5ddf..003cb10ac 100644 --- a/plugins/admin/groups/class_groupManagement.inc +++ b/plugins/admin/groups/class_groupManagement.inc @@ -526,20 +526,11 @@ class groupManagement extends plugin } } - - - - - - - /* * We also need to search for the departments * So we are able to navigate like in konquerer */ - /* Only needed if we are in GroupManagement */ - if(!$CreatePosixsList){ $res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", FALSE, $base, array("ou", "description"), TRUE); $this->departments= array(); @@ -555,7 +546,6 @@ class groupManagement extends plugin $this->departments[$value['dn']]= convert_department_dn2($value['dn']);//$value["description"][0]; } } - } /* Ende department generation */ @@ -594,39 +584,16 @@ class groupManagement extends plugin $tmp=array(); - /* If true ; this result is used for posix tab, group membership selection. */ - if($CreatePosixsList){ - - /* Addd to array */ - foreach($this->grouplist as $tkey => $val ){ - $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val; - } - - /* Sort index */ - ksort($tmp); - - /* Recreate index array[dn]=cn[description]*/ - $this->grouplist=array(); - foreach($tmp as $val){ - if(isset($val['description'])){ - $this->grouplist[$val['dn']]=$val['cn'][0]." [".$val['description'][0]."]"; - }else{ - $this->grouplist[$val['dn']]=$val['cn'][0]; - } - } - }else{ - - /* Create result for group management listbox*/ - foreach($this->grouplist as $tkey => $val ){ - $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val; - } - ksort($tmp); - $this->grouplist=array(); - foreach($tmp as $val){ - $this->grouplist[]=$val; - } - reset ($this->grouplist); + /* Create result for group management listbox*/ + foreach($this->grouplist as $tkey => $val ){ + $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val; + } + ksort($tmp); + $this->grouplist=array(); + foreach($tmp as $val){ + $this->grouplist[]=$val; } + reset ($this->grouplist); } function remove_from_parent() diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index bbf8b92c3..72d5ce1cb 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -59,6 +59,8 @@ class posixAccount extends plugin var $primaryGroup= 0; var $was_trust_account= FALSE; + var $grouplist = array(); + var $ui = array(); /* attribute list for save action */ var $attributes= array("homeDirectory", "loginShell", "uidNumber", "gidNumber", "gecos", @@ -204,6 +206,7 @@ class posixAccount extends plugin "regex" => "*"); register_global("sysfilter", $sysfilter); } + $this->ui = get_userinfo(); } @@ -372,7 +375,6 @@ class posixAccount extends plugin /* Manage group add dialog */ if ($this->group_dialog){ - $gd= new groupManagement($this->config, get_userinfo()); /* Save data */ $groupfilter= get_global("groupfilter"); @@ -402,9 +404,10 @@ class posixAccount extends plugin register_global("groupfilter", $groupfilter); /* Calculate actual groups */ - $gd->reload(true); + + $this->reload(); $glist= array(); - foreach ($gd->grouplist as $key => $value){ + foreach ($this->grouplist as $key => $value){ if (!isset($this->groupMembership[$key])){ $glist[$key]= $value; } @@ -1067,14 +1070,57 @@ class posixAccount extends plugin } + function reload() + { + /* Get config */ + $groupfilter= get_global('groupfilter'); -} + /* Set base for all searches */ + $base= $groupfilter['depselect']; -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: + /* Regex filter? */ + if ($groupfilter['regex'] != ""){ + $regex= $groupfilter['regex']; + } else { + $regex= "*"; + } + + $error = ""; + $ldap = $this->config->get_ldap_link(); + + $base= get_groups_ou().$base; + $res= get_list($this->ui->subtreeACL, "(objectClass=posixGroup)", FALSE, $base, array("cn", "description", "gidNumber"), TRUE); + if (preg_match("/size limit/i", $error)){ + $_SESSION['limit_exceeded']= TRUE; + } + $error = $ldap->error; + $this->grouplist = array(); + foreach ($res as $value){ + $this->grouplist[$value['gidNumber'][0]]= $value; + } + $tmp=array(); + foreach($this->grouplist as $tkey => $val ){ + $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val; + } + /* Sort index */ + ksort($tmp); + /* Recreate index array[dn]=cn[description]*/ + $this->grouplist=array(); + foreach($tmp as $val){ + if(isset($val['description'])){ + $this->grouplist[$val['dn']]=$val['cn'][0]." [".$val['description'][0]."]"; + }else{ + $this->grouplist[$val['dn']]=$val['cn'][0]; + } + } + reset ($this->grouplist); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/personal/posix/posix_groups.tpl b/plugins/personal/posix/posix_groups.tpl index f7e3207f1..044ebabce 100644 --- a/plugins/personal/posix/posix_groups.tpl +++ b/plugins/personal/posix/posix_groups.tpl @@ -23,13 +23,6 @@ {$alphabet}
-

- {t}Show primary groups{/t}
- {t}Show samba groups{/t}
- {t}Show application groups{/t}
- {t}Show mail groups{/t}
- {t}Show functional groups{/t} -

-- 2.30.2