From 1aa7ee03f11e1b8eb5b8b92f67c3cffc4f164653 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 2 Jul 2010 07:54:10 +0000 Subject: [PATCH] Prepared password change enforcement git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18915 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/users/class_userManagement.inc | 21 +++++++++++++++++++ gosa-core/plugins/admin/users/password.tpl | 7 ++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc index b382d695f..e7191e26d 100644 --- a/gosa-core/plugins/admin/users/class_userManagement.inc +++ b/gosa-core/plugins/admin/users/class_userManagement.inc @@ -46,6 +46,9 @@ class userManagement extends management protected $proposalEnabled = FALSE; protected $proposalSelected = FALSE; + protected $passwordChangeForceable = FALSE; + protected $enforcePasswordChange = FALSE; + function __construct($config,$ui) { $this->config = $config; @@ -247,11 +250,16 @@ class userManagement extends management if(isset($_POST['refreshProposal'])) $this->refreshProposal(); if(isset($_POST['proposalSelected'])) $this->proposalSelected = get_post('proposalSelected') == 1; + $this->enforcePasswordChange = isset($_POST['new_password']) && isset($_POST['enforcePasswordChange']); + $smarty = get_smarty(); $smarty->assign("proposal" , $this->proposal); $smarty->assign("proposalEnabled" , $this->proposalEnabled); $smarty->assign("proposalSelected" , $this->proposalSelected); + $smarty->assign("passwordChangeForceable" , $this->passwordChangeForceable); + $smarty->assign("enforcePasswordChange" , $this->enforcePasswordChange); + // Get next entry from queue. if(empty($this->dn) && count($this->pwd_change_queue)){ @@ -263,6 +271,19 @@ class userManagement extends management $smarty->assign("proposalSelected" , $this->proposalSelected); $this->dn = array_pop($this->pwd_change_queue); + + // Check if we are able to enforce a password change + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->cat($this->dn); + $attrs = $ldap->fetch(); + $this->passwordChangeForceable = + in_array('sambaAccount', $attrs['objectClass']) || + in_array('posixAccount', $attrs['objectClass']); + + $smarty->assign("passwordChangeForceable" , $this->passwordChangeForceable); + $smarty->assign("enforcePasswordChange" , $this->enforcePasswordChange); + set_object_info($this->dn); return ($smarty->fetch(get_template_path('password.tpl', TRUE))); } diff --git a/gosa-core/plugins/admin/users/password.tpl b/gosa-core/plugins/admin/users/password.tpl index 04ec469a8..a48f89fef 100644 --- a/gosa-core/plugins/admin/users/password.tpl +++ b/gosa-core/plugins/admin/users/password.tpl @@ -77,8 +77,13 @@ {/if} -
+{if $passwordChangeForceable} +
+  {t}Enforce password change on next login.{/t} +{/if} +

-- 2.30.2