From: hickert Date: Wed, 7 Jul 2010 14:09:28 +0000 (+0000) Subject: Updated samba tab X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a75d232ccf4b3a0a7f936ec0d4e1142ef87ed406;p=gosa.git Updated samba tab git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@18952 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/samba/personal/samba/class_sambaAccount.inc b/gosa-plugins/samba/personal/samba/class_sambaAccount.inc index ee352e7cb..15952a510 100644 --- a/gosa-plugins/samba/personal/samba/class_sambaAccount.inc +++ b/gosa-plugins/samba/personal/samba/class_sambaAccount.inc @@ -76,7 +76,7 @@ class sambaAccount extends plugin var $objectclasses= array('sambaSamAccount'); var $uid= ""; - var $CopyPasteVars = array("kickoff_time_set","logoff_time_set","logon_time_set","mungedObject","orig_sambaDomainName"); + var $CopyPasteVars = array("kickoff_time_set","logoff_time_set","logon_time_set","mungedObject","orig_sambaDomainName","enforcePasswordChange"); var $multiple_support = TRUE; @@ -86,6 +86,8 @@ class sambaAccount extends plugin var $no_expiry = FALSE; var $multiple_sambaUserWorkstations = array(); + var $enforcePasswordChange = FALSE; + function sambaAccount (&$config, $dn= NULL) { $this->mungedObject= new sambaMungedDial; @@ -173,6 +175,18 @@ class sambaAccount extends plugin #TODO: use date format $this->sambaKickoffTime= $this->sambaKickoffTime == 0?"":date('d.m.Y', $this->sambaKickoffTime); $this->sambaPwdMustChange= $this->sambaPwdMustChange == 2147483647?"":date('d.m.Y', $this->sambaPwdMustChange); + + // Enforce password change? + // ------------------------ + // Check if we've the attribute 'sambaPwdLastSet' set and if its value is 0, + // in this case a password change is forced for this account. + $this->enforcePasswordChange = (isset($this->attrs['sambaPwdLastSet']) && $this->attrs['sambaPwdLastSet'][0] == '0'); + + // User cannot change his password? (sambaPwdLastSet int max(Int)) + // -------------------------------- + // The user is not able to change his password while sambaPwdCanChange is 4294967295 (Integer 32 Bit max) + $this->cannotChangePassword = (isset($this->attrs['sambaPwdCanChange']) && $this->attrs['sambaPwdCanChange'][0] == '4294967295'); + } function execute() @@ -523,7 +537,7 @@ class sambaAccount extends plugin "onnectclientprinters","defaultprinter","shadow","brokenconn", "reconn","allow_pwchange","connectclientprinters","no_expiry","no_password_required","temporary_disable", "password_expires","logon_time_set","logoff_time_set","kickoff_time_set","SetSambaLogonHours", - "workstation_list") as $attr){ + "workstation_list","enforcePasswordChange","cannotChangePassword") as $attr){ if(in_array($attr,$this->multi_boxes)){ $smarty->assign("use_".$attr,TRUE); }else{ @@ -571,8 +585,10 @@ class sambaAccount extends plugin /* Show main page */ $smarty->assign("multiple_support",$this->multiple_support_active); - $display.= $smarty->fetch (get_template_path('samba3.tpl', TRUE, dirname(__FILE__))); + $smarty->assign('enforcePasswordChange', $this->enforcePasswordChange); + $smarty->assign("cannotChangePassword", $this->cannotChangePassword); + $display.= $smarty->fetch (get_template_path('samba3.tpl', TRUE, dirname(__FILE__))); return ($display); } @@ -956,6 +972,9 @@ class sambaAccount extends plugin if (isset($_POST['sambaTab'])){ plugin::save_object(); + $this->enforcePasswordChange = (isset($_POST['enforcePasswordChange'])); + $this->cannotChangePassword = (isset($_POST['cannotChangePassword'])); + if(isset($_POST['display_information'])){ msg_dialog::display(_("Information"), $this->get_samba_information(), @@ -1128,6 +1147,21 @@ class sambaAccount extends plugin } $this->attrs['objectClass']= $tmp; + // Enforce password change + if($this->enforcePasswordChange){ + $this->attrs['sambaPwdLastSet'] = 0; + }else{ + if ($this->sambaPwdLastSet != "0"){ + $this->attrs['sambaPwdLastSet']= $this->sambaPwdLastSet; + } else { + $this->attrs['sambaPwdLastSet']= array(); + } + } + + if($this->cannotChangePassword){ + $this->attrs['sambaPwdCanChange'] = 4294967295; + } + /* Generate rid / primaryGroupId */ if (!isset($this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['SID'])){ msg_dialog::display(_("Warning"), _("Undefined Samba SID detected. Please fix this problem manually!"), WARNING_DIALOG); @@ -1194,12 +1228,6 @@ class sambaAccount extends plugin } else { $this->attrs['sambaPwdMustChange']= array(); } - /* Make sure not to save zero in sambaPwdLastset */ - if ($this->sambaPwdLastSet != "0"){ - $this->attrs['sambaPwdLastSet']= $this->sambaPwdLastSet; - } else { - $this->attrs['sambaPwdLastSet']= array(); - } /* Account expiery */ if ($this->logon_time_set == "1"){ $this->attrs['sambaLogonTime']= $this->sambaLogonTime; @@ -1353,10 +1381,9 @@ class sambaAccount extends plugin "sambaAcctFlagsN" => _("Login from windows client requires no password"), "sambaAcctFlagsX" => _("Password never expires"), "sambaAcctFlagsL" => _("Lock samba account"), - "sambaKickoffTime" => _("Account expires") , "sambaPwdMustChange" => _("Password expires") , - "sambaLogonTime" => _("Limit Logon Time") , - "sambaLogoffTime" => _("Limit Logoff Time") , + "enforcePasswordChange" => _("Enforce password change"), + "cannotChangePassword" => _("Cannot change password"), "sambaLogonHours" => _("Logon hours") , "sambaUserWorkstations" => _("Allow connection from")) )); @@ -1379,7 +1406,7 @@ class sambaAccount extends plugin "onnectclientprinters","defaultprinter","shadow","brokenconn", "reconn","allow_pwchange","connectclientprinters","no_expiry","no_password_required","temporary_disable", "password_expires","logon_time_set","logoff_time_set","kickoff_time_set","SetSambaLogonHours", - "workstation_list") as $attr){ + "workstation_list","enforcePasswordChange","cannotChangePassword") as $attr){ if(isset($_POST["use_".$attr])){ $this->multi_boxes[] = $attr; } @@ -1569,7 +1596,15 @@ class sambaAccount extends plugin if(in_array("temporary_disable",$this->multi_boxes)){ $ret['temporary_disable'] = $this->temporary_disable; } - + + if(in_array("enforcePasswordChange",$this->multi_boxes)){ + $ret['enforcePasswordChange'] = $this->enforcePasswordChange; + } + if(in_array("cannotChangePassword",$this->multi_boxes)){ + $ret['cannotChangePassword'] = $this->cannotChangePassword; + } + + if(in_array("SetSambaLogonHours",$this->multi_boxes)){ $ret['sambaLogonHours'] = $this->sambaLogonHours; } diff --git a/gosa-plugins/samba/personal/samba/samba3.tpl b/gosa-plugins/samba/personal/samba/samba3.tpl index f78c1348b..ba683c234 100644 --- a/gosa-plugins/samba/personal/samba/samba3.tpl +++ b/gosa-plugins/samba/personal/samba/samba3.tpl @@ -305,107 +305,82 @@

 {t}Access options{/t}

+ +
- + - - - - - - - - - - - - {if $additional_info_PwdMustChange} - - - - {/if} - - - + + + + + + + + + + + + + + + + + + + + + {if $additional_info_PwdMustChange} + + + {/if} - {/render} - - - - - - - - -
- {render acl=$sambaAcctFlagsXACL checkbox=$multiple_support checked=$use_no_expiry} - - {/render} - -
- {render acl=$sambaAcctFlagsNACL checkbox=$multiple_support checked=$use_no_password_required} - - {/render} - -
- {render acl=$sambaAcctFlagsLACL checkbox=$multiple_support checked=$use_temporary_disable} - - {/render} - -
- ({$additional_info_PwdMustChange}) -
- {render acl=$sambaKickoffTimeACL checkbox=$multiple_support checked=$use_kickoff_time_set} - - {/render} - - - {render acl=$sambaKickoffTimeACL} - - {if $sambaKickoffTimeACL|regex_replace:"/[cdmr]/":"" == "w"} - +
+ {render acl=$enforcePasswordChangeACL checkbox=$multiple_support checked=$use_enforcePasswordChange} + + {/render} + + +
+ {render acl=$sambaAcctFlagsXACL checkbox=$multiple_support checked=$use_no_expiry} + + {/render} + + +
+ {render acl=$sambaAcctFlagsNACL checkbox=$multiple_support checked=$use_no_password_required} + + {/render} + + +
+ {render acl=$sambaAcctFlagsLACL checkbox=$multiple_support checked=$use_temporary_disable} + + {/render} + + +
+ {render acl=$cannotChangePasswordACL checkbox=$multiple_support checked=$use_cannotChangePassword} + + {/render} + + +
+ ({$additional_info_PwdMustChange}) +
 
- {render acl=$sambaLogonHoursACL mode=read_active checkbox=$multiple_support checked=$use_SetSambaLogonHours} - {t}Samba logon times{/t}  - {/render} -
+
+ +

 

+
+ + {render acl=$sambaLogonHoursACL mode=read_active checkbox=$multiple_support checked=$use_SetSambaLogonHours} + {t}Samba logon times{/t}  + {/render}