From 440ca408b9027e8feb9dde339b59ceb512a4f659 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 3 Nov 2008 09:37:27 +0000 Subject: [PATCH] Adapt password settings from templates too. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12865 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_password-methods.inc | 4 ++++ .../plugins/personal/generic/class_user.inc | 11 ++++++++++ .../kerberos/class_password-methods-MIT.inc | 22 +++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/gosa-core/include/password-methods/class_password-methods.inc b/gosa-core/include/password-methods/class_password-methods.inc index 13bf07ec2..e9a2182bc 100644 --- a/gosa-core/include/password-methods/class_password-methods.inc +++ b/gosa-core/include/password-methods/class_password-methods.inc @@ -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: ?> diff --git a/gosa-core/plugins/personal/generic/class_user.inc b/gosa-core/plugins/personal/generic/class_user.inc index d07458802..8f658bef4 100644 --- a/gosa-core/plugins/personal/generic/class_user.inc +++ b/gosa-core/plugins/personal/generic/class_user.inc @@ -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); diff --git a/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_password-methods-MIT.inc b/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_password-methods-MIT.inc index 2f8d3f9f6..10b3d52a5 100644 --- a/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_password-methods-MIT.inc +++ b/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_password-methods-MIT.inc @@ -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: ?> -- 2.30.2