From e187403d79ed0aa5df19a16b05f86f5e73ea095d Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 28 Apr 2010 13:45:13 +0000 Subject: [PATCH] Updated several plugins -Applied bugfixes catched during testing trunk git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@17911 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../gofax/faxaccount/class_gofaxAccount.inc | 2 +- .../environment/class_environment.inc | 9 ++- .../mail/personal/mail/class_mailAccount.inc | 78 ++++++++++++------- gosa-plugins/mail/personal/mail/copypaste.tpl | 15 +++- .../connectivity/pptp/class_pptpAccount.inc | 16 ++-- .../pureftpd/class_pureftpdAccount.inc | 6 -- .../admin/roleManagement/tabs_roles.inc | 2 +- .../personal/samba/class_sambaAccount.inc | 60 ++++++++++---- .../personal/samba/class_sambaLogonHours.inc | 7 +- .../webdav/class_webdavAccount.inc | 17 ++-- 10 files changed, 139 insertions(+), 73 deletions(-) diff --git a/gosa-plugins/gofax/gofax/faxaccount/class_gofaxAccount.inc b/gosa-plugins/gofax/gofax/faxaccount/class_gofaxAccount.inc index 35121299a..d3aa61639 100644 --- a/gosa-plugins/gofax/gofax/faxaccount/class_gofaxAccount.inc +++ b/gosa-plugins/gofax/gofax/faxaccount/class_gofaxAccount.inc @@ -744,7 +744,7 @@ class gofaxAccount extends plugin /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ if ($this->is_modified){ - $this->handle_post_events("mofidy",array("uid" => $this->uid)); + $this->handle_post_events("modify",array("uid" => $this->uid)); } } else { $this->handle_post_events("add",array("uid" => $this->uid)); diff --git a/gosa-plugins/goto/personal/environment/class_environment.inc b/gosa-plugins/goto/personal/environment/class_environment.inc index 30afb96fa..bf8550a3a 100644 --- a/gosa-plugins/goto/personal/environment/class_environment.inc +++ b/gosa-plugins/goto/personal/environment/class_environment.inc @@ -64,14 +64,15 @@ class environment extends plugin /* general settings */ // Sets the attributes which will kept on page reload, which will be saved, ... - var $CopyPasteVars = array("gotoHotplugDevices","gotoAvailableShares","gotoShareSelections","gotoPrinterSel","gotoProfileFlagL","gotoXResolutions","gotoProfileFlagC","gotoProfileServers","useProfile","is_group","in_dialog","OrigCn","gotoKioskProfile_Server","gotoKioskProfile_Profile"); + var $CopyPasteVars = array("gotoHotplugDevices","gotoAvailableShares","gotoShareSelections","gotoPrinterSel", "gotoProfileFlagL","gotoXResolutions","gotoProfileFlagC","gotoProfileServers","useProfile","is_group","in_dialog","OrigCn", "gotoKioskProfile_Server","gotoKioskProfile_Profile", "gotoLogonScripts","gotoLogonScript","gotoShare","gotoShares"); var $attributes = array("uid","gotoProfileServer","gotoProfileFlags","gotoHotplugDeviceDN", "gotoXResolution","gotoProfileQuota", - "gotoLogonScripts","gotoLogonScript", + "gotoLogonScript","gotoLogonScripts","gotoHotplugDevices", "gotoPrinter", "gosaDefaultPrinter", - "gotoShares","gotoShare", + "gotoShare", "gotoKioskProfile"); + var $objectclasses = array("gotoEnvironment"); // Specifies the objectClass which contains the attributes edited here var $cn; var $OrigCn; @@ -912,6 +913,8 @@ class environment extends plugin $type = "AddUser"; }elseif(isset($this->NewDeletedPrinters[$pname])){ $type = "AddUser"; + }elseif($this->dn == "new"){ + $type = "AddUser"; }elseif($printerObj->by_object['printgeneric']->AddMember("AddUser",$this->dn)){ $type = "AddUser"; } diff --git a/gosa-plugins/mail/personal/mail/class_mailAccount.inc b/gosa-plugins/mail/personal/mail/class_mailAccount.inc index 79428a6f4..1cf306a63 100644 --- a/gosa-plugins/mail/personal/mail/class_mailAccount.inc +++ b/gosa-plugins/mail/personal/mail/class_mailAccount.inc @@ -1130,49 +1130,73 @@ class mailAccount extends plugin } } - - /*! \brief Creates the mail part for the copy & paste dialog - */ + /*! \brief Creates the mail part for the copy & paste dialog + */ function getCopyDialog() { - if(!$this->is_account) return(""); - $smarty = get_smarty(); - $smarty->assign("mail",$this->mail); - $smarty->assign("gosaMailAlternateAddress",$this->gosaMailAlternateAddress); - $smarty->assign("gosaMailForwardingAddress",$this->gosaMailForwardingAddress); + if(!$this->is_account) return(""); + $smarty = get_smarty(); + $smarty->assign("mail",$this->mail); + $smarty->assign("gosaMailAlternateAddress",$this->gosaMailAlternateAddress); + $smarty->assign("gosaMailForwardingAddress",$this->gosaMailForwardingAddress); + + $smarty->assign("domainSelectionEnabled", $this->mailMethod->domainSelectionEnabled()); + $smarty->assign("MailDomains", $this->mailDomainParts); + $smarty->assign("MailDomain" , $this->mailDomainPart); + $smarty->assign("MailServers", $this->mailMethod->getMailServers()); + $smarty->assign("isModifyableMail" , $this->mailMethod->isModifyableMail()); + $smarty->assign("initially_was_account", $this->initially_was_account); + $str = $smarty->fetch(get_template_path("copypaste.tpl",TRUE, dirname(__FILE__))); - $ret = array(); - $ret['status'] = ""; - $ret['string'] = $str; - return($ret); + $ret = array(); + $ret['status'] = ""; + $ret['string'] = $str; + return($ret); } - - /*! \brief save_object for copy&paste vars - */ + + /*! \brief save_object for copy&paste vars + */ function saveCopyDialog() { - if(!$this->is_account) return; + if(!$this->is_account) return; - /* Execute to save mailAlternateAddress && gosaMailForwardingAddress */ - $this->execute(); - if(isset($_POST['mail'])){ - $this->mail = $_POST['mail']; - } + /* Execute to save mailAlternateAddress && gosaMailForwardingAddress */ + $this->execute(); + if(isset($_POST['mail'])){ + $this->mail = $_POST['mail']; + } } - - /*! \brief Prepare this account to be copied + /*! \brief Prepare this account to be copied */ function PrepareForCopyPaste($source) { - plugin::PrepareForCopyPaste($source); + plugin::PrepareForCopyPaste($source); + + /* Reset alternate mail addresses */ + $this->gosaMailAlternateAddress = array(); - /* Reset alternate mail addresses */ - $this->gosaMailAlternateAddress = array(); - } + /* If the doamin part is selectable, we have to split the mail address + */ + if($this->mailMethod->domainSelectionEnabled()){ + $this->mailDomainPart = preg_replace("/^[^@]*+@/","",$this->mail); + $this->mail = preg_replace("/@.*$/","\\1",$this->mail); + if(!in_array($this->mailDomainPart,$this->mailDomainParts)){ + $this->mailDomainParts[] = $this->mailDomainPart; + } + } + + // Initialize Vacation start/stop times + // This value is set to 'dd.mm.YYYY' if no times are set in the source object. + // But if they are set, then this values contain timestamps. + if(isset($source['gosaVacationStart'][0])){ + $this->gosaVacationStart= date('d.m.Y', $source['gosaVacationStart'][0]); + $this->gosaVacationStop= date('d.m.Y', $source['gosaVacationStop'][0]); + } + } /*! \brief Prepare this class the be useable when editing multiple users at once */ diff --git a/gosa-plugins/mail/personal/mail/copypaste.tpl b/gosa-plugins/mail/personal/mail/copypaste.tpl index 8c8b3d0a7..acc931ee0 100644 --- a/gosa-plugins/mail/personal/mail/copypaste.tpl +++ b/gosa-plugins/mail/personal/mail/copypaste.tpl @@ -5,7 +5,20 @@ - + {if !$isModifyableMail && $initially_was_account} + + {else} + {if $domainSelectionEnabled} + + @ + + {else} + + {/if} + {/if} +
{$must}
diff --git a/gosa-plugins/pptp/personal/connectivity/pptp/class_pptpAccount.inc b/gosa-plugins/pptp/personal/connectivity/pptp/class_pptpAccount.inc index ebbf600a6..3bc07fea6 100644 --- a/gosa-plugins/pptp/personal/connectivity/pptp/class_pptpAccount.inc +++ b/gosa-plugins/pptp/personal/connectivity/pptp/class_pptpAccount.inc @@ -138,7 +138,6 @@ class pptpAccount extends plugin /* Save to LDAP */ function save() { - if($this->acl_is_createable()){ plugin::save(); /* Write back to ldap */ @@ -149,24 +148,23 @@ class pptpAccount extends plugin /* Log last action */ if($this->initially_was_account){ - new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); }else{ - new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } if (!$ldap->success()){ - msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class())); + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class())); } /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ - if ($this->is_modified){ - $this->handle_post_events("modify",array("uid" => $this->uid)); - } + if ($this->is_modified){ + $this->handle_post_events("modify",array("uid" => $this->uid)); + } } else { - $this->handle_post_events("add",array("uid" => $this->uid)); + $this->handle_post_events("add",array("uid" => $this->uid)); } - } } diff --git a/gosa-plugins/pureftpd/personal/connectivity/pureftpd/class_pureftpdAccount.inc b/gosa-plugins/pureftpd/personal/connectivity/pureftpd/class_pureftpdAccount.inc index 3410cedfa..2042f8a40 100644 --- a/gosa-plugins/pureftpd/personal/connectivity/pureftpd/class_pureftpdAccount.inc +++ b/gosa-plugins/pureftpd/personal/connectivity/pureftpd/class_pureftpdAccount.inc @@ -217,12 +217,6 @@ class pureftpdAccount extends plugin { plugin::save(); - $tmp = $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $key => $desc){ - if(!$this->acl_is_writeable($key)){ - unset($this->attrs[$key]); - } - } /* Write back to ldap */ $ldap= $this->config->get_ldap_link(); diff --git a/gosa-plugins/rolemanagement/admin/roleManagement/tabs_roles.inc b/gosa-plugins/rolemanagement/admin/roleManagement/tabs_roles.inc index 0441fdbb9..5ab586cf6 100644 --- a/gosa-plugins/rolemanagement/admin/roleManagement/tabs_roles.inc +++ b/gosa-plugins/rolemanagement/admin/roleManagement/tabs_roles.inc @@ -25,7 +25,7 @@ class roletabs extends tabs function __construct($config, $data, $dn,$hide_refs = FALSE, $hide_acls = FALSE) { - tabs::tabs($config, $data, $dn,"roles",$hide_refs, $hide_acls); + tabs::tabs($config, $data, $dn,$hide_refs, $hide_acls); $this->base = $baseobject= $this->by_object['roleGeneric']->base; $this->addSpecialTabs(); diff --git a/gosa-plugins/samba/personal/samba/class_sambaAccount.inc b/gosa-plugins/samba/personal/samba/class_sambaAccount.inc index bf86d6a46..ee352e7cb 100644 --- a/gosa-plugins/samba/personal/samba/class_sambaAccount.inc +++ b/gosa-plugins/samba/personal/samba/class_sambaAccount.inc @@ -65,8 +65,15 @@ class sambaAccount extends plugin /* attribute list for save action */ var $ctxattributes= array(); - var $attributes= array(); - var $objectclasses= array(); + var $attributes= array("sambaSID", "sambaPwdLastSet", "sambaLogonTime", + "sambaLogoffTime", "sambaKickoffTime", "sambaPwdCanChange", + "sambaPwdMustChange", "sambaAcctFlags", "uid", "sambaMungedDial", + "sambaHomePath", "sambaHomeDrive", "sambaLogonScript", + "sambaProfilePath", "sambaPrimaryGroupSID", "sambaDomainName", + "sambaUserWorkstations", "sambaPasswordHistory", + "sambaLogonHours", "sambaBadPasswordTime", + "sambaBadPasswordCount"); + var $objectclasses= array('sambaSamAccount'); var $uid= ""; var $CopyPasteVars = array("kickoff_time_set","logoff_time_set","logon_time_set","mungedObject","orig_sambaDomainName"); @@ -81,16 +88,6 @@ class sambaAccount extends plugin function sambaAccount (&$config, $dn= NULL) { - /* Load attributes depending on the samba version */ - $this->attributes= array ("sambaSID", "sambaPwdLastSet", "sambaLogonTime", - "sambaLogoffTime", "sambaKickoffTime", "sambaPwdCanChange", - "sambaPwdMustChange", "sambaAcctFlags", "uid", "sambaMungedDial", - "sambaHomePath", "sambaHomeDrive", "sambaLogonScript", - "sambaProfilePath", "sambaPrimaryGroupSID", "sambaDomainName", - "sambaUserWorkstations", "sambaPasswordHistory", - "sambaLogonHours", "sambaBadPasswordTime", - "sambaBadPasswordCount"); - $this->objectclasses= array ("sambaSamAccount"); $this->mungedObject= new sambaMungedDial; $this->ctxattributes= $this->mungedObject->ctxattributes; @@ -233,7 +230,7 @@ class sambaAccount extends plugin /* Open Samaba Logong hours dialog */ if(isset($_POST['SetSambaLogonHours']) && $this->acl_is_readable("sambaLogonHours")){ - $this->dialog = new sambaLogonHours($this->config,$this->dn,$this->sambaLogonHours); + $this->dialog = new sambaLogonHours($this->config,$this->dn,$this->sambaLogonHours, $this->getacl('sambaLogonHours')); } /* Cancel dialog */ @@ -1716,6 +1713,43 @@ class sambaAccount extends plugin /* Set a new SID */ $this->sambaSID = ""; + + /* Fill mungedDial field */ + if (isset($source['sambaMungedDial'])){ + $this->mungedObject->load($source['sambaMungedDial'][0]); + } + + /* Password expiery */ + if(isset($source['sambaPwdMustChange']) && + $source['sambaPwdMustChange'][0] != 0){ + $this->password_expires= 1; + } + + if(isset($source['sambaLogonTime']) && ! ( + $source['sambaLogonTime'][0] == 0 || + $source['sambaLogonTime'][0] == 2147483647 + )){ + $this->logon_time_set= 1; + } + if(isset($source['sambaLogoffTime']) && ! ( + $source['sambaLogoffTime'][0] == 0 || + $source['sambaLogoffTime'][0] == 2147483647 + )){ + $this->logoff_time_set= 1; + } + + /* Account expiery */ + if(isset($source['sambaKickoffTime']) && ! ( + $source['sambaKickoffTime'][0] == 0 || + $source['sambaKickoffTime'][0] == 2147483647 + )){ + $this->kickoff_time_set= 1; + } + + + if(isset($source['sambaKickoffTime'][0])){ + $this->sambaKickoffTime = date('d.m.Y', $source['sambaKickoffTime'][0]); + } } } diff --git a/gosa-plugins/samba/personal/samba/class_sambaLogonHours.inc b/gosa-plugins/samba/personal/samba/class_sambaLogonHours.inc index d37cd2e64..eea919579 100644 --- a/gosa-plugins/samba/personal/samba/class_sambaLogonHours.inc +++ b/gosa-plugins/samba/personal/samba/class_sambaLogonHours.inc @@ -7,11 +7,13 @@ class sambaLogonHours extends plugin var $Matrix = array(); var $timezone = 0; var $config; + var $acl; - function sambaLogonHours (&$config, $dn, $slh) + function sambaLogonHours (&$config, $dn, $slh, $acl = 'rw') { plugin::plugin($config,$dn); $this->sambaLogonHours = $slh; + $this->acl = $acl; /* Get default timezone */ $zone = timezone::get_default_timezone(); @@ -62,8 +64,7 @@ class sambaLogonHours extends plugin $ui =get_userinfo(); $smarty = get_smarty(); - $acl = $ui->get_permissions($this->dn,"users/sambaAccount","sambaLogonHours"); - $smarty->assign("acl",preg_match("/w/i",$acl)); + $smarty->assign("acl",preg_match("/w/i",$this->acl)); $hours = array(); for($i = 0 ; $i <24 ; $i++ ){ diff --git a/gosa-plugins/webdav/personal/connectivity/webdav/class_webdavAccount.inc b/gosa-plugins/webdav/personal/connectivity/webdav/class_webdavAccount.inc index 3af4185d9..9cf3a2765 100644 --- a/gosa-plugins/webdav/personal/connectivity/webdav/class_webdavAccount.inc +++ b/gosa-plugins/webdav/personal/connectivity/webdav/class_webdavAccount.inc @@ -127,7 +127,6 @@ class webdavAccount extends plugin /* Save to LDAP */ function save() { - if($this->acl_is_createable()){ plugin::save(); /* Write back to ldap */ @@ -138,26 +137,26 @@ class webdavAccount extends plugin /* Log last action */ if($this->initially_was_account){ - new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); }else{ - new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } if (!$ldap->success()){ - msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class())); + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class())); } /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ - if ($this->is_modified){ - $this->handle_post_events("modify",array("uid" => $this->uid)); - } + if ($this->is_modified){ + $this->handle_post_events("modify",array("uid" => $this->uid)); + } } else { - $this->handle_post_events("add",array("uid" => $this->uid)); + $this->handle_post_events("add",array("uid" => $this->uid)); } - } } + /* Return plugin informations for acl handling #FIXME This is only an enable/disable checkbox for this account, there is possibly a better solution available later */ static function plInfo() -- 2.30.2