diff --git a/plugins/personal/samba/class_sambaAccount.inc b/plugins/personal/samba/class_sambaAccount.inc
index df2cba2e4dedce2f1021ba790ef447984e590dc5..7f548f72ad144addb2a30e1a13394385c411aedf 100644 (file)
var $sambaLogonTime= "0";
var $sambaLogoffTime= "2147483647";
var $sambaKickoffTime= "2147483647";
- var $sambaPwdCanChange= "0";
+ var $sambaPwdCanChange= "";
var $sambaPwdMustChange= "0";
var $sambaAcctFlags= "[UX ]";
var $sambaHomePath= "";
var $attributes= array();
var $objectclasses= array();
+ var $CopyPasteVars = array("kickoff_time_set","logoff_time_set","logon_time_set","mungedObject","orig_sambaDomainName");
+
function sambaAccount ($config, $dn= NULL)
{
/* Load attributes depending on the samba version */
$this->SID= preg_replace ("/-[^-]+$/", "", $this->sambaSID);
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
- $ldap->search ("(&(objectClass=sambaDomain)(sambaSID=$this->SID))");
+ $ldap->search ("(&(objectClass=sambaDomain)(sambaSID=$this->SID))",array("sambaAlgorithmicRidBase","sambaDomainName"));
if ($ldap->count() != 0){
$attrs= $ldap->fetch();
$this->ridBase= $attrs['sambaAlgorithmicRidBase'][0];
$acl= array($this->config->current['BASE'] => ":all");
$regex= $sambafilter['regex'];
$filter= "(&(objectClass=sambaSAMAccount)$exclude(uid=*$)(|(uid=$regex)(cn=$regex)))";
- $res= get_list($acl, "$filter", TRUE, $sambafilter['depselect'], array("uid"), TRUE);
+ $res= get_list($filter, $acl, $sambafilter['depselect'], array("uid"), GL_SUBSEARCH | GL_SIZELIMIT);
$wslist= array();
foreach ($res as $attrs){
$wslist[]= preg_replace('/\$/', '', $attrs['uid'][0]);
$smarty->assign("reconnmode", $this->mungedObject->getReConn());
$smarty->assign("reconnACL", chkacl($this->acl,"reconn"));
- /* Set form elements to disabled/enable state */
- $smarty->assign("tsloginstate", $this->mungedObject->getTsLogin()?"":"disabled");
- $smarty->assign("inheritstate", $this->mungedObject->getInheritMode()?"disabled":"");
-
+ if($_SESSION['js']){
+ /* Set form elements to disabled/enable state */
+ $smarty->assign("tsloginstate", $this->mungedObject->getTsLogin()?"":"disabled");
+ $smarty->assign("inheritstate", $this->mungedObject->getInheritMode()?"disabled":"");
+ }else{
+ $smarty->assign("tsloginstate", "");
+ $smarty->assign("inheritstate", "");
+ }
+
/* Set checkboxes to checked or unchecked state */
$smarty->assign("tslogin", $this->mungedObject->getTsLogin()?"checked":"");
$smarty->assign("tsloginACL", chkacl($this->acl,"tslogin"));
$smarty->assign("flagsK", "");
}
- $smarty->assign("allow_pwchangeACL", chkacl($this->acl, "allow_pwchange"));
- $smarty->assign("password_expiresACL", chkacl($this->acl, "password_expires"));
- $smarty->assign("no_password_requiredACL", chkacl($this->acl, "no_password_required"));
- $smarty->assign("temporary_disableACL", chkacl($this->acl, "temporary_disable"));
- $smarty->assign("sambaDomainNameACL", chkacl($this->acl, "sambaDomainName"));
- $smarty->assign("logon_time_setACL", chkacl($this->acl, "logon_time_set"));
- $smarty->assign("logoff_time_setACL", chkacl($this->acl, "logoff_time_set"));
- $smarty->assign("kickoff_time_setACL", chkacl($this->acl, "kickoff_time_set"));
- $smarty->assign("sambaLogonTimeACL", chkacl($this->acl, "sambaLogonTime"));
- $smarty->assign("sambaLogoffTimeACL", chkacl($this->acl, "sambaLogoffTime"));
- $smarty->assign("sambaKickoffTimeACL", chkacl($this->acl, "sambaKickoffTime"));
+ $smarty->assign("allow_pwchangeACL", chkacl($this->acl, "allow_pwchange"));
+ $smarty->assign("password_expiresACL", chkacl($this->acl, "password_expires"));
+ $smarty->assign("no_password_requiredACL", chkacl($this->acl, "no_password_required"));
+ $smarty->assign("temporary_disableACL", chkacl($this->acl, "temporary_disable"));
+ $smarty->assign("sambaDomainNameACL", chkacl($this->acl, "sambaDomainName"));
+ $smarty->assign("logon_time_setACL", chkacl($this->acl, "logon_time_set"));
+ $smarty->assign("logoff_time_setACL", chkacl($this->acl, "logoff_time_set"));
+ $smarty->assign("kickoff_time_setACL", chkacl($this->acl, "kickoff_time_set"));
+ $smarty->assign("sambaLogonTimeACL", chkacl($this->acl, "sambaLogonTime"));
+ $smarty->assign("sambaLogoffTimeACL", chkacl($this->acl, "sambaLogoffTime"));
+ $smarty->assign("sambaKickoffTimeACL", chkacl($this->acl, "sambaKickoffTime"));
/* In case of javascript, disable some fields on demand */
@DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
$this->attributes, "Save");
$ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- show_ldap_error($ldap->get_error());
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
+
+ show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/samba account with dn '%s' failed."),$this->dn));
/* Optionally execute a command after we're done */
$this->handle_post_events("remove");
/* Check for input problems */
function check()
{
- $message= array();
+ /* Call common method to give check the hook */
+ $message= plugin::check();
if ($this->samba3){
{
/* Load uid and gid of this 'dn' */
$ldap= $this->config->get_ldap_link();
- $ldap->cat($this->dn);
+ $ldap->cat($this->dn, array('uidNumber', 'gidNumber'));
$tmp= $ldap->fetch();
$this->uidNumber= $tmp['uidNumber'][0];
$this->gidNumber= $tmp['gidNumber'][0];
/* Check for users primary group */
$ldap->cd($this->config->current['BASE']);
- $ldap->search("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))",
- array("cn"));
+ $ldap->search("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))", array("cn"));
if ($ldap->count() != 1){
print_red(_("Warning: Can't identify users primary group - no conversion to a samba group possible!"));
} else {
/* Write back to ldap */
$ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- show_ldap_error($ldap->get_error());
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
+
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/samba account with dn '%s' failed."),$this->dn));
/* Optionally execute a command after we're done */
if ($this->initially_was_account == $this->is_account){
$sambafilter= array( "depselect" => $base, "regex" => "*");
register_global("sambafilter", $sambafilter);
}
-
-
}
+
+ function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Samba"),
+ "plDescription" => _("Samba settings"),
+ "plSelfModify" => TRUE,
+ "plDepends" => array("user"),
+ "plPriority" => 5, // Position in tabs
+ "plSection" => "personal", // This belongs to personal
+ "plCategory" => array("users"), // Add to following categories
+ "plOptions" => array(),
+
+ "plProvidedAcls" => array(
+ "AllowLoginOnTerminalServer" => _("Allow login on terminal server"),
+ "InheritClientConfig" => _("Inherit client config"),
+ "sambaAcctFlags_N" => _("Login from windows client requires no password"),
+ "sambaAcctFlags_L" => _("Lock samba account"),
+
+ "sambaLogonTime" => _("Limit Logon Time") ,
+ "sambaLogoffTime" => _("Limit Logoff Time") ,
+ "sambaKickoffTime" => _("Account expires") ,
+ "sambaPwdCanChange" => _("Allow user to change password") ,
+ "sambaPwdMustChange" => _("Password expires") ,
+ "sambaHomePath" => _("Generic home directory") ,
+ "sambaHomeDrive" => _("Generic samba home drive") ,
+ "sambaLogonScript" => _("Generic script path") ,
+ "sambaProfilePath" => _("Generic profile path") ,
+ "sambaDomainName" => _("Domain") ,
+ "sambaUserWorkstations" => _("Allow connection from")))
+ );
+ }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: