From: hickert Date: Wed, 11 Jun 2008 13:13:37 +0000 (+0000) Subject: Replace placeholders in samba templates X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=86b8c34629e055c2c3b7aed3255fead2e796c4c6;p=gosa.git Replace placeholders in samba templates git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11287 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/samba/personal/samba/class_sambaAccount.inc b/gosa-plugins/samba/personal/samba/class_sambaAccount.inc index a5fec4f2c..f17dada9b 100644 --- a/gosa-plugins/samba/personal/samba/class_sambaAccount.inc +++ b/gosa-plugins/samba/personal/samba/class_sambaAccount.inc @@ -1122,14 +1122,29 @@ class sambaAccount extends plugin function adapt_from_template($dn, $skip= array()) { plugin::adapt_from_template($dn, $skip); + + $this->sambaSID= ""; $this->sambaPrimaryGroupSID= ""; - /* Fill mungedDial field */ + /* Fill mungedDial field */ if ($this->samba3 && isset($this->attrs['sambaMungedDial']) && !in_array('sambaMungedDial', $skip)){ $this->mungedObject->load($this->sambaMungedDial); } + /* Adapt munged attributes */ + foreach($this->ctxattributes as $attr){ + if(isset($this->mungedObject->ctx[$attr])) + $val = $this->mungedObject->ctx[$attr]; + + foreach (array("sn", "givenName", "uid") as $repl){ + if (preg_match("/%$repl/i", $val)){ + $val= preg_replace ("/%$repl/i", $this->parent->$repl, $val); + } + } + $this->mungedObject->ctx[$attr] = $val; + } + /* Password expiery */ if(isset($this->attrs['sambaPwdMustChange']) && $this->attrs['sambaPwdMustChange'][0] != 0 && !in_array('sambaPwdMustChange', $skip)){