summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: af221bb)
raw | patch | inline | side by side (parent: af221bb)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 13 Jan 2009 08:57:33 +0000 (08:57 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 13 Jan 2009 08:57:33 +0000 (08:57 +0000) |
-Added first samba Info version.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13342 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13342 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/samba/personal/samba/class_sambaAccount.inc | patch | blob | history | |
gosa-plugins/samba/personal/samba/samba3.tpl | patch | blob | history |
diff --git a/gosa-plugins/samba/personal/samba/class_sambaAccount.inc b/gosa-plugins/samba/personal/samba/class_sambaAccount.inc
index 9b32cd88b63512682d0e123de80f841e3cae5637..919d4581fc9d355aee6f6467402640cc014c929f 100644 (file)
var $uidNumber= 65535;
var $gidNumber= 65535;
+ /* Samba 3 infos */
+ var $display_informations = FALSE;
+
/* Samba 2 attributes */
var $pwdLastSet= "0";
var $logonTime= "0";
/* Show main page */
$smarty->assign("multiple_support",$this->multiple_support_active);
if ($this->samba3){
+
+ $smarty->assign("samba_informations","");
+ $smarty->assign("display_informations",$this->display_informations);
+ if($this->display_informations){
+ $smarty->assign("samba_informations",$this->get_samba_informations());
+ }
+
$display.= $smarty->fetch (get_template_path('samba3.tpl', TRUE, dirname(__FILE__)));
} else {
$display.= $smarty->fetch (get_template_path('samba2.tpl', TRUE, dirname(__FILE__)));
return ($display);
}
+
+ function get_samba_informations()
+ {
+
+ /* Defaults
+ */
+ $sambaMinPwdLength = "unset";
+ $sambaPwdHistoryLength = "unset";
+ $sambaLogonToChgPwd = "unset";
+ $sambaMaxPwdAge = "unset";
+ $sambaMinPwdAge = "unset";
+ $sambaLockoutDuration = "unset";
+ $sambaBadPasswordTime = "unset";
+ $sambaLockoutThreshold = "unset";
+ $sambaForceLogoff = "unset";
+ $sambaRefuseMachinePwdChange = "unset";
+
+
+ /* Get samba SID object and parse settings.
+ */
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ if(!empty($this->sambaDomainName) && isset($this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName])){
+ $cfg = $this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName];
+ $ldap->search("(&(objectClass=sambaDomain)(sambaSID=".$cfg['SID']."))",array("*"));
+ if($ldap->count() >= 1){
+ $attrs = $ldap->fetch();
+ $attributes = array("sambaMinPwdLength","sambaPwdHistoryLength","sambaMaxPwdAge","sambaMinPwdAge","sambaLockoutDuration","sambaRefuseMachinePwdChange","sambaLogonToChgPwd","sambaBadPasswordTime","sambaLockoutThreshold","sambaForceLogoff");
+ foreach($attributes as $attr){
+ if(isset($this->$attr) && $this->$attr != ""){
+ $$attr = $this->$attr;
+ }elseif(isset($this->attrs[$attr])){
+ $$attr = $this->attrs[$attr][0];
+ }elseif(isset($attrs[$attr])){
+ $$attr = $attrs[$attr][0];
+ }
+ }
+ }
+ }
+
+ /* Password length has a default of 5
+ */
+ if($sambaMinPwdLength == "unset" || $sambaMinPwdLength == 5){
+ $sambaMinPwdLength = "5 <i>("._("default").")</i>";
+ }
+
+ /* Length of Password History Entries (default: 0 => off)
+ */
+ if($sambaPwdHistoryLength == "unset" || $sambaPwdHistoryLength == 0){
+ $sambaPwdHistoryLength = _("Off")." <i>("._("default").")</i>";
+ }
+
+ /* Force Users to logon for password change (default: 0 => off, 2 => on)
+ */
+ if($sambaLogonToChgPwd == "unset" || $sambaLogonToChgPwd == 0){
+ $sambaLogonToChgPwd = _("Off")." <i>("._("default").")</i>";
+ }else{
+ $sambaLogonToChgPwd = _("On");
+ }
+
+ /* Maximum password age, in seconds (default: -1 => never expire passwords)'
+ */
+ if($sambaMaxPwdAge == "unset" || $sambaMaxPwdAge == "-1"){
+ $sambaMaxPwdAge = _("disabled")." <i>("._("default").")</i>";
+ }else{
+ $sambaMaxPwdAge .= " "._("seconds");
+ }
+
+ /* Minimum password age, in seconds (default: 0 => allow immediate password change
+ */
+ if($sambaMinPwdAge == "unset" || $sambaMinPwdAge == 0){
+ $sambaMinPwdAge = _("disabled")." <i>("._("default").")</i>";
+ }else{
+ $sambaMinPwdAge .= " "._("seconds");
+ }
+
+ /* Lockout duration in minutes (default: 30, -1 => forever)
+ */
+ if($sambaLockoutDuration == "unset" || $sambaLockoutDuration == 30){
+ $sambaLockoutDuration = "30 "._("minutes")." <i>("._("default").")</i>";
+ }elseif($sambaLockoutDuration == -1){
+ $sambaLockoutDuration = _("forever");
+ }else{
+ $sambaLockoutDuration .= _("minutes");
+ }
+
+ /* Time of the last bad password attempt
+ */
+ if($sambaBadPasswordTime == "none" || empty($sambaBadPasswordTime)){
+ $sambaBadPasswordTime = "<i>("._("unset").")</i>";
+ }else{
+ $sambaBadPasswordTime = date("d.m.Y H:i:s",$sambaBadPasswordTime);
+ }
+
+ /* Lockout users after bad logon attempts (default: 0 => off
+ */
+ if($sambaLockoutThreshold == "unset" || $sambaLockoutThreshold == 0){
+ $sambaLockoutThreshold = _("disabled")." <i>("._("default").")</i>";
+ }
+
+ /* Disconnect Users outside logon hours (default: -1 => off, 0 => on
+ */
+ if($sambaForceLogoff == "unset" || $sambaForceLogoff == -1){
+ $sambaForceLogoff = _("off")." <i>("._("default").")</i>";
+ }else{
+ $sambaForceLogoff = _("on");
+ }
+
+ /* Allow Machine Password changes (default: 0 => off
+ */
+ if($sambaRefuseMachinePwdChange == "none" || $sambaRefuseMachinePwdChange == 0){
+ $sambaRefuseMachinePwdChange = _("off")." <i>("._("default").")</i>";
+ }else{
+ $sambaRefuseMachinePwdChange = _("on");
+ }
+
+
+ $str =
+ "\n<table>".
+ "\n<tr><td>"._("Min password length").": </td><td>".$sambaMinPwdLength."</td></tr>".
+ "\n<tr><td>"._("Password history").": </td><td>".$sambaPwdHistoryLength."</td></tr>".
+ "\n<tr><td>"._("Force password change").": </td><td>".$sambaLogonToChgPwd."</td></tr>".
+ "\n<tr><td>"._("Maximum password age").": </td><td>".$sambaMaxPwdAge."</td></tr>".
+ "\n<tr><td>"._("Minimum password age").": </td><td>".$sambaMinPwdAge."</td></tr>".
+ "\n<tr><td>"._("Lockout duration").": </td><td>".$sambaLockoutDuration."</td></tr>".
+ "\n<tr><td>"._("Reset count minutes").": </td><td>".$sambaBadPasswordTime."</td></tr>".
+ "\n<tr><td>"._("Bad lockout attempt").": </td><td>".$sambaLockoutThreshold."</td></tr>".
+ "\n<tr><td>"._("Disconnect time").": </td><td>".$sambaForceLogoff."</td></tr>".
+ "\n<tr><td>"._("Refuse machine password change").":</td><td>".$sambaRefuseMachinePwdChange."</td></tr>".
+ "\n</table>";
+ return($str);
+ }
+
+
function remove_from_parent()
{
/* Cancel if there's nothing to do here */
if (isset($_POST['sambaTab'])){
plugin::save_object();
+ if(isset($_POST['display_informations'])){
+ $this->display_informations = !$this->display_informations;
+ }
+
/* Take care about access options */
if ($this->acl_is_writeable("sambaAcctFlagsL",$SkipWrite) || ($this->acl_is_writeable("sambaAcctFlagsN",$SkipWrite))){
if ($this->samba3){
diff --git a/gosa-plugins/samba/personal/samba/samba3.tpl b/gosa-plugins/samba/personal/samba/samba3.tpl
index aecc65815f8fb41725e94af72b21d1fe20f68271..2ae4d66e26cbd83230ebfc1489aebddcea7cdbea 100644 (file)
{/render}
</td>
</tr>
+ <tr>
+ <td>{t}Informations{/t}</td>
+ <td>
+ {if $display_informations}
+ <input type='submit' name='display_informations' value='{t}Hide{/t}'>
+ {else}
+ <input type='submit' name='display_informations' value='{t}Show{/t}'>
+ {/if}
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ {if $display_informations}
+ {$samba_informations}
+ {/if}
+ <td>
+ </tr>
</table>
</td>
<td style="border-left:1px solid #A0A0A0">