Code

Updated user plugins
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Jan 2009 10:45:03 +0000 (10:45 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Jan 2009 10:45:03 +0000 (10:45 +0000)
-Templates were not working as expected

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13336 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/users/class_userManagement.inc
gosa-core/plugins/admin/users/tabs_user.inc

index 452c6437fd3a42f6cd86ca47d6c245b554ea0957..8b8848a833ad952a1c1dbad6e4640613e885ab21 100644 (file)
@@ -902,17 +902,15 @@ class userManagement extends plugin
     /* Finish template preamble */
     if (isset($_POST['template_continue']) && $_POST['template'] != 'none' && (isset($_POST['uid']))){
 
-      /* Might not be filled if IDGEN is unset */
-      $this->sn                 = $_POST['sn'];
-      $this->givenName          = $_POST['givenName'];
-
       /* Move user supplied data to sub plugins */
-      $this->uid                = $_POST['uid'];
-      $this->usertab->uid       = $this->uid;
-      $this->usertab->sn        = $this->sn;
-      $this->usertab->givenName = $this->givenName;
+      foreach(array("uid","sn","givenName") as $attr){
+        $this->$attr = $_POST[$attr];
+        $this->usertab->$attr       = $this->$attr;
+        $this->usertab->by_object['user']->$attr = $this->$attr;
+      }
+
       $template_dn              = $_POST['template'];
-      $this->usertab->adapt_from_template($template_dn);
+      $this->usertab->adapt_from_template($template_dn, array("uid","cn","givenName","sn"));
       $template_base            = preg_replace("/^[^,]+,".preg_quote(get_people_ou(), '/')."/", '', $template_dn);
       $this->usertab->by_object['user']->base= $template_base;
     }
index 37f5e719ae09dc7b1a6cc61f08cd521f38d135d9..0f95ed9012d8bae37ebe401b6500eee1bb0a70e7 100644 (file)
@@ -24,11 +24,21 @@ class usertabs extends tabs
 {
   var $base;
 
+  /* Template adaption variables
+   */
+  var $uid  ="";
+  var $givenName = "";
+  var $sn;
+
   function usertabs($config, $data, $dn)
   {
     tabs::tabs($config, $data, $dn, 'users');
     $this->base= $this->by_object['user']->base;
 
+    $this->uid = &$this->by_object['user']->uid;
+    $this->sn = &$this->by_object['user']->sn;
+    $this->givenName = &$this->by_object['user']->givenName;
+
     /* Add references/acls/snapshots */
     $this->addSpecialTabs();