X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fgroups%2Fclass_groupGeneric.inc;h=dba7c496a53745fb9410f59249b686eb368ce143;hb=bfaaf679dd6eaabbc8e0b581b465179dbe7d9319;hp=4e28493250fc868cdd17729d30e1f59e4bc5283f;hpb=97c9e2aa3045265a53ac06ba35a93b9e632af300;p=gosa.git diff --git a/plugins/admin/groups/class_groupGeneric.inc b/plugins/admin/groups/class_groupGeneric.inc index 4e2849325..dba7c496a 100644 --- a/plugins/admin/groups/class_groupGeneric.inc +++ b/plugins/admin/groups/class_groupGeneric.inc @@ -1,4 +1,5 @@ data,"faiManagement","CLASS"); - if(!empty($tmp)){ - $this->description = preg_replace("/\(.*\)$/","",$this->description); - } - /* Load attributes depending on the samba version */ $this->samba3= ($config->current['SAMBAVERSION'] == 3); $this->orig_dn= $dn; @@ -161,7 +157,9 @@ class group extends plugin $this->base= dn2base($ui->dn); } } else { - $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn); + + /* Get object base */ + $this->base =preg_replace ("/^[^,]+,".normalizePreg(get_groups_ou())."/","",$this->dn); } /* This is always an account */ @@ -427,18 +425,34 @@ class group extends plugin } } if(!empty($filter)){ + $ldap->cd($this->config->current['BASE']); $ldap->search("(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(|".$filter."))",array("uid","sn","givenName")); while($attrs = $ldap->fetch()){ $this->members[$attrs['uid'][0]] = $this->createResultName($attrs); $this->allusers[$attrs['uid'][0]]= $this->createResultName($attrs); } } - + + /* check if all uids are resolved */ + foreach ($this->memberUid as $value){ + if(!isset($this->members[$value])){ + $this->members[$value] = _("! unknown id")." [".$value."]"; + } + } /* Create display list of users matching regex & filter */ $this->displayUsers = array(); - $filter = "(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(!(uid=*$))(|(uid=".$regex.")(sn=".$regex.")(givenName=".$regex.")))"; + + /* Set tag attribute if we've tagging activated */ + $tag= ""; + $ui= get_userinfo(); + if ($ui->gosaUnitTag != "" && isset($this->config->current['STRICT_UNITS']) && + preg_match('/TRUE/i', $this->config->current['STRICT_UNITS'])){ + $tag= "(gosaUnitTag=".$ui->gosaUnitTag.")"; + } + + $filter = "(&(objectClass=gosaAccount)$tag(!(objectClass=gosaUserTemplate))(!(uid=*$))(|(uid=".$regex.")(sn=".$regex.")(givenName=".$regex.")))"; /* Search in current tree or within subtrees depending on the checkbox from filter section */ if($gufilter['SubSearchGroup']){ @@ -492,7 +506,7 @@ class group extends plugin $ldap= $this->config->get_ldap_link(); $ldap->rmdir($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing group failed")); /* Delete references to object groups */ $ldap->cd ($this->config->current['BASE']); @@ -575,24 +589,6 @@ class group extends plugin } } - /* If release management is enabled .... - Append release name to description tag .. - #FIXME release name within description is a very bad solution, use ldap attribute instead - */ - $tmp = search_config($this->config->data,"faiManagement","CLASS"); - if(!empty($tmp)){ - if(isset($this->parent)){ - if(isset($this->parent->by_object['appgroup'])){ - $baseObj = $this->parent->by_object['appgroup']; - if($baseObj->is_account){ - if(isset($baseObj->Release)){ - $this->description .= " (".trim($baseObj->Release).")"; - } - } - } - } - } - plugin::save(); /* Remove objectClass for samba/phone support */ @@ -682,7 +678,7 @@ class group extends plugin /* Save data. Using 'modify' implies that the entry is already present, use 'add' for new entries. So do a check first... */ - $ldap->cat ($this->dn); + $ldap->cat ($this->dn, array('dn')); if ($ldap->fetch()){ /* Modify needs array() to remove values :-( */ if (!count ($this->memberUid)){ @@ -707,7 +703,7 @@ class group extends plugin $ldap->$mode($this->attrs); $ret= 0; - if (show_ldap_error($ldap->get_error())){ + if (show_ldap_error($ldap->get_error(), _("Saving group failed"))){ $ret= 1; } @@ -756,8 +752,7 @@ class group extends plugin $ldap= $this->config->get_ldap_link(); if(($this->cn != $this->orig_cn) || ($this->orig_dn == "new")){ $ldap->cd("ou=groups,".$this->base); - //FIXME: hardcoded ou=groups, - $ldap->ls("(&(|(objectClass=gosaGroupOfNames)(objectClass=posixGroup))(cn=$this->cn))","ou=groups,".$this->base,array("cn")); + $ldap->ls("(&(|(objectClass=gosaGroupOfNames)(objectClass=posixGroup))(cn=$this->cn))",get_groups_ou().$this->base,array("cn")); if ($ldap->count() != 0){ $message[]= _("Value specified as 'Name' is already used."); } @@ -820,15 +815,15 @@ class group extends plugin } /* Find out next free id near to UID_BASE */ - for ($id= $this->config->current['UIDBASE']; $id++; $id<65000){ + for ($id= $this->config->current['UIDBASE']; $id++; $id < pow(2,32)){ if (!in_array($id, $ids)){ return ($id); } } - /* Should not happen */ - if ($id == 65000){ - print_red(_("Too many users, can't allocate a free ID!")); + /* check if id reached maximum of 32 bit*/ + if ($id >= pow(2,32)){ + echo _("Too many users, can't allocate a free ID!"); exit; } }