diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc
index dfab7aeff04b3eb18c78241d53c41bb9c6ebc744..ab0d224943c7e6a540a8078a42dca0db7b6d3275 100644 (file)
class userManagement extends management
{
var $plHeadline = "Users";
class userManagement extends management
{
var $plHeadline = "Users";
- var $plDescription = "Manage users";
+ var $plDescription = "Manage aspects of user accounts like generic, posix, samba and mail settings";
var $plIcon = "plugins/users/images/user.png";
var $sn = "";
var $plIcon = "plugins/users/images/user.png";
var $sn = "";
var $edit_uid = "";
var $pwd_change_queue = array();
var $edit_uid = "";
var $pwd_change_queue = array();
+ var $force_hash_type = array();
// Tab definition
protected $tabClass = "usertabs";
// Tab definition
protected $tabClass = "usertabs";
function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
{
function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
{
- management::editEntry($action,$target);
+ $str = management::editEntry($action,$target);
+ if($str) return($str);
if(preg_match("/^edit_/",$action)){
$tab = preg_replace("/^edit_/","",$action);
if(preg_match("/^edit_/",$action)){
$tab = preg_replace("/^edit_/","",$action);
function handlePasswordQueue()
{
function handlePasswordQueue()
{
+ $smarty = get_smarty();
+
// 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);
// 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)));
}
return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
}
// Display errors
if (count($message) != 0){
msg_dialog::displayChecks($message);
// Display errors
if (count($message) != 0){
msg_dialog::displayChecks($message);
- $smarty = get_smarty();
return($smarty->fetch(get_template_path('password.tpl', TRUE)));
}
// Change cassword
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(isset($this->force_hash_type[$this->dn])){
+ if(!change_password ($this->dn, $_POST['new_password'],0,$this->force_hash_type[$this->dn])){
+ return($smarty->fetch(get_template_path('password.tpl', TRUE)));
+ }
+ }else{
+ 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);
}
if ($this->config->get_cfg_value("passwordHook") != ""){
exec($this->config->get_cfg_value("passwordHook")." ".$username." ".$_POST['new_password'], $resarr);
*/
function saveChanges()
{
*/
function saveChanges()
{
- management::saveChanges();
- if($this->last_dn == "new"){
+ $str = management::saveChanges();
+
+ if(!empty($str)) return($str);
+
+ if($this->last_tabObject instanceOf multi_plug){
+ foreach($this->last_tabObject->a_handles as $user){
+ if($user->password_change_needed()){
+ $this->force_hash_type[$user->dn] = $user->by_object['user']->pw_storage;
+ $this->pwd_change_queue[] = $user->dn;
+ }
+ }
+ return($this->handlePasswordQueue());
+ }
+
+ if(isset($this->last_tabObject->by_object['user']) && $this->last_tabObject->by_object['user']->password_change_needed()){
+ $this->force_hash_type[$this->last_tabObject->dn] = $this->last_tabObject->by_object['user']->pw_storage;
+ $this->pwd_change_queue[] = $this->last_tabObject->dn;
+ return($this->handlePasswordQueue());
+ }
+ }
+
+ function cancelEdit()
+ {
+ $str = management::cancelEdit();
+ if(!empty($str)) return($str);
+
+ if(isset($this->last_tabObject->by_object['user']) &&
+ $this->last_tabObject->by_object['user']->dn != "new" &&
+ $this->last_tabObject->by_object['user']->password_change_needed()){
+ $this->force_hash_type[$this->last_tabObject->dn] = $this->last_tabObject->by_object['user']->pw_storage;
$this->pwd_change_queue[] = $this->last_tabObject->dn;
return($this->handlePasswordQueue());
}
$this->pwd_change_queue[] = $this->last_tabObject->dn;
return($this->handlePasswordQueue());
}
function newUserFromTemplate($action="",$target=array(),$all=array())
{
// Call parent method, it knows whats to do, locking and so on ...
function newUserFromTemplate($action="",$target=array(),$all=array())
{
// Call parent method, it knows whats to do, locking and so on ...
- management::newEntry($action,$target,$all);
+ $str = management::newEntry($action,$target,$all);
+ if(!empty($str)) return($str);
// Reset uid selection.
$this->got_uid= "";
// Reset uid selection.
$this->got_uid= "";
{
// Call parent method, it manages everything, locking, object creation...
{
// Call parent method, it manages everything, locking, object creation...
- management::newEntry($action,$target,$all);
+ $str = management::newEntry($action,$target,$all);
+ if(!empty($str)) return($str);
// If we've at least one template, then ask the user if he wants to use one?
$templates = array();
// If we've at least one template, then ask the user if he wants to use one?
$templates = array();
$templates = array_merge($templates,$this->get_templates());
// Display template selection
$templates = array_merge($templates,$this->get_templates());
// Display template selection
- if (count($templates)){
+ if (count($templates) > 1){
$smarty = get_smarty();
// Set default variables, normally empty.
$smarty = get_smarty();
// Set default variables, normally empty.
// Adapt template values.
$template_dn = $_POST['template'];
$this->tabObject->adapt_from_template($template_dn, array("uid","cn","givenName","sn"));
// Adapt template values.
$template_dn = $_POST['template'];
$this->tabObject->adapt_from_template($template_dn, array("uid","cn","givenName","sn"));
- $template_base = preg_replace("/^[^,]+,".preg_quote(get_people_ou(), '/')."/", '', $template_dn);
+ $template_base = preg_replace("/^[^,]+,".preg_quote(get_people_ou(), '/i')."/", '', $template_dn);
$this->tabObject->by_object['user']->base= $template_base;
// The user Tab object is already instantiated, so just go back and let the
$this->tabObject->by_object['user']->base= $template_base;
// The user Tab object is already instantiated, so just go back and let the
// Check entry locking
foreach($target as $dn){
if (($user= get_lock($dn)) != ""){
// Check entry locking
foreach($target as $dn){
if (($user= get_lock($dn)) != ""){
+ $this->dn = $dn;
return(gen_locked_message ($user, $dn));
}
$this->dns[] = $dn;
return(gen_locked_message ($user, $dn));
}
$this->dns[] = $dn;
*/
function lockUsers($action,$target,$all)
{
*/
function lockUsers($action,$target,$all)
{
+ if(!count($target)) return;
if($action == "lockUsers"){
$this->lockEntry($action,$target, $all, "lock");
}else{
if($action == "lockUsers"){
$this->lockEntry($action,$target, $all, "lock");
}else{
function copyPasteHandler($action="",$target=array(),$all=array(),
$altTabClass ="", $altTabType = "", $altAclCategory="",$altAclPlugin="")
{
function copyPasteHandler($action="",$target=array(),$all=array(),
$altTabClass ="", $altTabType = "", $altAclCategory="",$altAclPlugin="")
{
- $this->cpHandler->lastdn = "";
- $str = management::copyPasteHandler($action,$target,$all);
- if($this->cpHandler->lastdn != "" && isset($_POST['passwordTodo']) && $_POST['passwordTodo'] == "new"){
- $this->pwd_change_queue[] = $this->cpHandler->lastdn;
- return($this->handlePasswordQueue());
+ if ($this->config->boolValueIsTrue("main", "copyPaste")){
+ $this->cpHandler->lastdn = "";
+ $str = management::copyPasteHandler($action,$target,$all);
+ if($this->cpHandler->lastdn != "" && isset($_POST['passwordTodo']) && $_POST['passwordTodo'] == "new"){
+ $this->pwd_change_queue[] = $this->cpHandler->lastdn;
+ return($this->handlePasswordQueue());
+ }
+ return($str);
}
}
- return($str);
+
+ return "";
}
}
$label= "";
if(isset($userPassword[0]) && preg_match("/^\{[^\}]/",$userPassword[0])){
if(preg_match("/^[^\}]*+\}!/",$userPassword[0])){
$label= "";
if(isset($userPassword[0]) && preg_match("/^\{[^\}]/",$userPassword[0])){
if(preg_match("/^[^\}]*+\}!/",$userPassword[0])){
- $label= _("Unlock account");
+ $label= _("Unlock account")."<rowClass:entry-locked/>";
}else{
$label= _("Lock account");
}
}else{
$label= _("Lock account");
}
// Walk thru map
foreach ($map as $oc => $properties) {
// Walk thru map
foreach ($map as $oc => $properties) {
- if (in_array_ics($oc, $classes) || 1) {
- $result.="<input class='center' type='image' src='".$properties['image']."' ".
- "alt='".$properties['alt']."' title='".$properties['title'].
- "' name='listing_edit_".$properties['plugin']."_$row' style='padding:1px'>";
+ if (in_array_ics($oc, $classes)) {
+ $result.= image($properties['image'], "listing_edit_".$properties['plugin']."_$row", $properties['title']);
} else {
} else {
- $result.="<img src='images/empty.png' alt=' ' class='center' style='padding:1px'>";
+ $result.= image('images/empty.png');
}
}
return $result;
}
}
return $result;