From: hickert Date: Wed, 2 May 2012 12:37:38 +0000 (+0000) Subject: Do not create a group for templates. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ac53aaaf50a6e6a92ff77b89f2a014215c2dc88e;p=gosa.git Do not create a group for templates. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@21143 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/personal/posix/class_posixAccount.inc b/gosa-core/plugins/personal/posix/class_posixAccount.inc index 2befec7c1..7754baeaf 100644 --- a/gosa-core/plugins/personal/posix/class_posixAccount.inc +++ b/gosa-core/plugins/personal/posix/class_posixAccount.inc @@ -156,6 +156,12 @@ class posixAccount extends plugin } $this->initially_was_account= $this->is_account; + // Templates do not have a gidNumber + if($this->gidNumber == 2147483647){ + $this->gidNumber = ""; + $this->primaryGroup = 0; + } + /* Fill group */ $this->primaryGroup= $this->gidNumber; @@ -245,7 +251,7 @@ class posixAccount extends plugin /* Generate group list */ $this->ui = get_userinfo(); - $this->secondaryGroups[]= "- "._("automatic")." -"; + $this->secondaryGroups[0]= "- "._("automatic")." -"; $ldap->cd($this->config->current['BASE']); $ldap->search("(objectClass=posixGroup)", array("cn", "gidNumber")); while($attrs = $ldap->fetch()){ @@ -806,7 +812,9 @@ class posixAccount extends plugin * - .. if we couldn't find a group with the same name, we will create a new one, * using the users uid as cn and a generated uniqe gidNumber. * */ - if ($this->primaryGroup == 0 || $this->force_ids){ + if($this->is_template && !$this->primaryGroup){ + $this->gidNumber = 2147483647; + }elseif ($this->primaryGroup == 0 || $this->force_ids){ /* Search for existing group */ $ldap = $this->config->get_ldap_link(); @@ -1226,10 +1234,16 @@ class posixAccount extends plugin } /* Fix primary group settings */ - $ldap->cd($this->config->current['BASE']); - $ldap->search("(&(objectClass=posixGroup)(cn=$template)(gidNumber=".$this->gidNumber."))", array("cn")); - if ($ldap->count() != 1){ - $this->primaryGroup= $this->gidNumber; + if($this->gidNumber == 2147483647){ + $this->gidNumber = ""; + } + + if($this->gidNumber){ + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=posixGroup)(cn=$template)(gidNumber=".$this->gidNumber."))", array("cn")); + if ($ldap->count() != 1){ + $this->primaryGroup= $this->gidNumber; + } } $ldap->cd($this->config->current['BASE']);