Code

Prepared password change enforcement
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 2 Jul 2010 07:54:10 +0000 (07:54 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 2 Jul 2010 07:54:10 +0000 (07:54 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18915 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/users/class_userManagement.inc
gosa-core/plugins/admin/users/password.tpl

index b382d695fd3168b164480275823cf9dc84a2004b..e7191e26d631bbd06faee3663cb886d8a5104e53 100644 (file)
@@ -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)));
         }
index 04ec469a8c6e5a7792bfd652b0b4d461f3c67fb8..a48f89fef10239c1ab62bb60e25dfb44d469bae2 100644 (file)
 
 {/if}
 
-<br>
+{if $passwordChangeForceable}
+    <hr>
+    <input type='checkbox' name='enforcePasswordChange' value='1'
+        {if $enforcePasswordChange} checked {/if}>&nbsp;{t}Enforce password change on next login.{/t}
+{/if}
 
+<br>
 <hr>
 <div class="plugin-actions">
   <button type='submit' id='password_finish'name='password_finish'>{t}Set password{/t}</button>