Code

Updated several plugins
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 Apr 2010 13:45:13 +0000 (13:45 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 Apr 2010 13:45:13 +0000 (13:45 +0000)
-Applied bugfixes catched during testing trunk

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@17911 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/gofax/gofax/faxaccount/class_gofaxAccount.inc
gosa-plugins/goto/personal/environment/class_environment.inc
gosa-plugins/mail/personal/mail/class_mailAccount.inc
gosa-plugins/mail/personal/mail/copypaste.tpl
gosa-plugins/pptp/personal/connectivity/pptp/class_pptpAccount.inc
gosa-plugins/pureftpd/personal/connectivity/pureftpd/class_pureftpdAccount.inc
gosa-plugins/rolemanagement/admin/roleManagement/tabs_roles.inc
gosa-plugins/samba/personal/samba/class_sambaAccount.inc
gosa-plugins/samba/personal/samba/class_sambaLogonHours.inc
gosa-plugins/webdav/personal/connectivity/webdav/class_webdavAccount.inc

index 35121299af835ee1dc84e9eedfe3c75418942050..d3aa616399257cc8df8baf4de2ec7244a7c72fdf 100644 (file)
@@ -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));
index 30afb96fa63740471c49103dcaf5083fc4ff6ee1..bf8550a3aa5a6220e7b6c1e902a1401f476f789b 100644 (file)
@@ -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";
             }
index 79428a6f43f70831bdc8c0ca89bd76f448a03788..1cf306a63fe880d45b601ca281c63f9920870ae0 100644 (file)
@@ -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 
    */
index 8c8b3d0a7763e90f611753b468dd2c02aee9dc7b..acc931ee0dd55c92a50f3f81093458aa5a1300a2 100644 (file)
@@ -5,7 +5,20 @@
                        <table style="width:100%;">
                                <tr>
                                        <td><label for="mail">{t}Primary address{/t}</label>{$must}</td>
-                                       <td><input type='text' id="mail" name="mail" size=35 maxlength=65 value="{$mail}"></td>
+                      {if !$isModifyableMail && $initially_was_account}
+                       <input type='text' disabled size=30 value="{$mail}">
+                      {else}
+                       {if $domainSelectionEnabled}
+                        <input type='text' id="mail" name="mail" size=20 maxlength=65 value="{$mail}">
+                        @
+                        <select name='MailDomain' size=1>
+                         {html_options values=$MailDomains output=$MailDomains selected=$MailDomain}
+                        </select>
+                       {else}
+                        <input type='text' id="mail" name="mail" size=35 maxlength=65 value="{$mail}">
+                       {/if}
+                      {/if}
+                   </td>
                                </tr>
                                <tr>
                                        <td colspan="2">
index ebbf600a6249dcc9d0ba808fbf3ddb78f3f7bdab..3bc07fea6829db849b1a28a4411d3741d3de36a8 100644 (file)
@@ -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));
       }
-    }
   }
 
 
index 3410cedfaf9663de8846c607b1dceb4e5a89c115..2042f8a4014bc601dff1ca7c99a36627f81bc792 100644 (file)
@@ -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();
index 0441fdbb99bc44ae6157ac3edd8bf4dcb6083852..5ab586cf633f2cfdf55a4a7ba3dabb35a428e3ef 100644 (file)
@@ -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();
 
index bf86d6a46275ce138becfcaa177fae67575b5b87..ee352e7cb9f5be0dea0f7dd05b67363c378d3b06 100644 (file)
@@ -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]); 
+    }
   }
 
 }
index d37cd2e64492db3e8c319b9c13fd61d600479391..eea9195792440b564d4ba83ac88b2de3c8954ade 100644 (file)
@@ -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++ ){
index 3af4185d9520d776b6f6d756ddb4a7f7ec0b03be..9cf3a2765d99f5c4f3d3a4b654844561e9e85c78 100644 (file)
@@ -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()