summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fd01066)
raw | patch | inline | side by side (parent: fd01066)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 27 Oct 2009 12:19:16 +0000 (12:19 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 27 Oct 2009 12:19:16 +0000 (12:19 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14652 594d385d-05f5-0310-b6e9-bd551577e9d8
index 00629634d68a977af09248dff77c905c308f6a18..5d6ea8ed4b28919f62c97d083f6fec479d5cd235 100644 (file)
protected $dn = "";
protected $dns = array();
+ protected $last_dn = "";
+ protected $last_dns = array();
+
protected $tabClass = "";
protected $tabType = "";
protected $aclCategory = "";
protected $objectName = "";
protected $tabObject = null;
+ protected $dialogObject = null;
+
+ protected $last_tabObject = null;
+ protected $last_dialogObject = null;
protected $displayApplyBtn = "";
protected $cpHandler = null;
protected function closeDialogs()
{
+ $this->last_dn = $this->dn;
+ $this->last_dns = $this->dns;
+ $this->last_tabObject = $this->tabObject;
+ $this->last_dialogObject = $this->dialogObject;
+
$this->dn = "";
$this->dns = array();
$this->tabObject = null;
diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc
index d27045db6de1115392671ada830b8673a581bcf1..b15d6bfcffb4cadd570dca0f93461f1a1901f538 100644 (file)
var $got_uid = "";
var $edit_uid = "";
+ var $pwd_change_queue = array();
+
// Tab definition
protected $tabClass = "usertabs";
protected $tabType = "USERTABS";
$this->registerAction("templatize", "templatizeUsers");
$this->registerAction("templatizeContinue", "templatizeContinue");
+ $this->registerAction("password", "changePassword");
+ $this->registerAction("passwordQueue", "handlePasswordQueue");
+ $this->registerAction("passwordCancel", "closeDialogs");
+
$this->registerAction("sendMessage", "sendMessage");
$this->registerAction("saveEventDialog", "saveEventDialog");
$this->registerAction("abortEventDialog", "closeDialogs");
if(isset($_POST['templatize_continue'])) $action['action'] = "templatizeContinue";
if(isset($_POST['save_event_dialog'])) $action['action'] = "saveEventDialog";
if(isset($_POST['abort_event_dialog'])) $action['action'] = "abortEventDialog";
+ if(isset($_POST['password_cancel'])){
+ $action['action'] = "passwordCancel";
+ }elseif((count($this->pwd_change_queue) || isset($_POST['password_finish']))){
+ $action['action'] = "passwordQueue";
+ }
return($action);
}
+ function closeDialogs()
+ {
+ management::closeDialogs();
+ $this->pwd_change_queue = array();
+ }
+
+
/*! \brief Sends a message to a set of users using gosa-si events.
*/
function sendMessage($action="",$target=array(),$all=array())
}
+ /*! \brief Queues a set of users for password changes
+ */
+ function changePassword($action="",$target=array(),$all=array())
+ {
+ $this->dn ="";
+ $this->pwd_change_queue = $target;
+
+ // Check permisions
+ $disallowed = array();
+ foreach($this->pwd_change_queue as $key => $dn){
+ if(!preg_match("/w/",$this->ui->get_permissions($dn,$this->aclCategory."/password"))){
+ unset($this->pwd_change_queue[$key]);
+ $disallowed[] = $dn;
+ }
+ }
+ if(count($disallowed)){
+ msg_dialog::display(_("Permission"),msgPool::permModify($disallowed),INFO_DIALOG);
+ }
+
+ // Now display change dialog.
+ return($this->handlePasswordQueue());
+ }
+
+
+ function handlePasswordQueue()
+ {
+ // Get next entry from queue.
+ if(empty($this->dn) && count($this->pwd_change_queue)){
+ $this->dn = array_pop($this->pwd_change_queue);
+ set_object_info($this->dn);
+ $smarty = get_smarty();
+ return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
+ }
+
+ // Check permissions
+ $dn = $this->dn;
+ $acl = $this->ui->get_permissions($dn, "users/password");
+ $cacl= $this->ui->get_permissions($dn, "users/user");
+ if (preg_match('/w/', $acl) || preg_match('/c/', $cacl)){
+ $message= array();
+ if ($_POST['new_password'] != $_POST['repeated_password']){
+ $message[]= _("The passwords you've entered as 'New password' and 'Repeated new password' do not match.");
+ } else {
+ if ($_POST['new_password'] == ""){
+ $message[] = msgPool::required(_("New password"));
+ }
+ }
+
+ // Display errors
+ if (count($message) != 0){
+ msg_dialog::displayChecks($message);
+ $smarty = get_smarty();
+ return($smarty->fetch(get_template_path('password.tpl', TRUE)));
+ }
+
+ // Change cassword
+ if(!change_password ($this->dn, $_POST['new_password'])){
+ return($smarty->fetch(get_template_path('password.tpl', TRUE)));
+ }
+ if ($this->config->get_cfg_value("passwordHook") != ""){
+ exec($this->config->get_cfg_value("passwordHook")." ".$username." ".$_POST['new_password'], $resarr);
+ }
+ new log("modify","users/".get_class($this),$this->dn,array(),"Password has been changed");
+ $this->dn ="";
+
+ } else {
+ msg_dialog::display(_("Password change"),
+ _("You have no permission to change this users password!"),
+ WARNING_DIALOG);
+ }
+
+ // Cleanup
+ if(!count($this->pwd_change_queue)){
+ $this->remove_lock();
+ $this->closeDialogs();
+ }else{
+ return($this->handlePasswordQueue());
+ }
+ }
+
+
+ /*! \brief Save user modifications.
+ * Whenever we save a 'new' user, request a password change for him.
+ */
+ function saveChanges()
+ {
+ management::saveChanges();
+ if($this->last_dn == "new"){
+ $this->pwd_change_queue[] = $this->last_tabObject->dn;
+ return($this->handlePasswordQueue());
+ }
+ }
+
+
/*! \brief Intiates user creation.
* If we've user templates, then the user will be asked to use to use one.
* -> See 'templateContinue' for further handling.
diff --git a/gosa-core/plugins/admin/users/user-list.xml b/gosa-core/plugins/admin/users/user-list.xml
index 3552af42c0638263d5da841f14bc9bb60be5cc1a..88ae7826fece5d203870a4535d192b2bff170f57 100644 (file)
<label>Remove</label>
</action>
+ <action>
+ <name>password</name>
+ <type>entry</type>
+ <image>plugins/users/images/list_password.png</image>
+ <label>Change password</label>
+ </action>
+
<action>
<type>separator</type>
</action>
<action>
<name>sendMessage</name>
<type>entry</type>
+ <depends>goto</depends>
<image>plugins/goto/images/notify.png</image>
<label>Send message</label>
</action>