Code

Adapt password settings from templates too.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Nov 2008 09:37:27 +0000 (09:37 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Nov 2008 09:37:27 +0000 (09:37 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12865 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/password-methods/class_password-methods.inc
gosa-core/plugins/personal/generic/class_user.inc
gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_password-methods-MIT.inc

index 13bf07ec29f4478240be648e00ca43455eeb42fc..e9a2182bcba5bca225e5d2a27fc6d5956bfc1eb6 100644 (file)
@@ -190,6 +190,10 @@ class passwordMethod
     return $this->hash;
   }
 
+  function adapt_from_template($dn)
+  {
+    return($this);
+  }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index d07458802a52c9acafc922769d1f98b1d745e12c..8f658bef4989bf07a2fb35a6a12b9958634bb9d2 100644 (file)
@@ -1383,6 +1383,17 @@ class user extends plugin
   {
     plugin::adapt_from_template($dn, $skip);
 
+    /* Get password method from template 
+     */
+    $tmp= passwordMethod::get_method($this->attrs['userPassword'][0]);
+    if(is_object($tmp)){
+      if($tmp->is_configurable()){
+        $tmp->adapt_from_template($dn);
+        $this->pwObject = &$tmp;
+      }
+      $this->pw_storage= $tmp->get_hash();
+    }
+
     /* Get base */
     $this->base= preg_replace('/^[^,]+,'.get_people_ou().'/i', '', $dn);
 
index 2f8d3f9f6d7fa2cc203fb8f4a4cb693de26d6a09..10b3d52a51217d1f3f6c4f7ff88e526051315295 100644 (file)
@@ -344,6 +344,12 @@ class passwordMethodMIT extends passwordMethod
     return "{".$mode."}".$this->attrs['uid'][0]."@".$this->goKrbRealm;
   }
 
+  
+  public function create_template_hash($attrs)
+  {
+    return($this->generate_hash());
+  }
+
 
   /*! \brief  Removes this principal.
    */
@@ -573,6 +579,19 @@ class passwordMethodMIT extends passwordMethod
   }
 
 
+  /*! \brief  Adapt account settings from given dn 
+   */ 
+  public function adapt_from_template ($dn)
+  {
+    $source = new passwordMethodMIT($this->config,$dn);
+    $attrs = array("PRINC_EXPIRE_TIME","PW_EXPIRATION","POLICY","MAX_LIFE","MAX_RENEWABLE_LIFE","MASK","used_flags");
+     foreach($attrs as $attr){
+      $this->$attr = $source->$attr;
+    }
+    print_a($this);
+  }
+
+
   /*! \brief Saves changes back to the SI daemon.
    */
   public function save($dn)
@@ -638,6 +657,9 @@ class passwordMethodMIT extends passwordMethod
       }
     }
   }
+
+  
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>