Code

Fixed account toggle for mail/samba/posix/environment.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 11 Jan 2007 06:46:00 +0000 (06:46 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 11 Jan 2007 06:46:00 +0000 (06:46 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5525 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/environment/class_environment.inc
plugins/personal/mail/class_mailAccount.inc
plugins/personal/posix/class_posixAccount.inc
plugins/personal/samba/class_sambaAccount.inc

index a163a7e4af0da4b5a0cb5ae95331f8767ea0acc1..accb3d7e831b1700feea2f80a5847acb4349ab48 100644 (file)
@@ -293,7 +293,11 @@ class environment extends plugin
 
       /* Change state if needed */
       if (isset($_POST['modify_state'])){
-        $this->is_account= !$this->is_account;
+        if($this->is_account && $this->acl == "#all#"){
+          $this->is_account= !$this->is_account;
+        }elseif(!$this->is_account && chkacl($this->acl,"create") == ""){
+          $this->is_account= !$this->is_account;
+        }
       }
 
       /* Group Dialog with enabled environment options */
@@ -327,13 +331,17 @@ class environment extends plugin
 
       /* Do we need to flip is_account state? */
       if (isset($_POST['modify_state'])){
-       
-        /* Onyl change state if we have posixs enabled or we want to remove this account */ 
-        if(!(!$this->parent->by_object['posixAccount']->is_account && !$this->is_account)){
+
+        /* Onyl change account state if allowed */
+        if(!$this->parent->by_object['posixAccount']->is_account && !$this->is_account){
+        }elseif($this->is_account && $this->acl == "#all#"){
+          $this->is_account= !$this->is_account;
+        }elseif(!$this->is_account && chkacl($this->acl,"create") == ""){
           $this->is_account= !$this->is_account;
         }
       }
 
+
       if(isset($this->parent)){
 
         // 3. Account enabled . Editing from adminmenu
index a0bc50807778e1422b2199e5695595bace8f702c..0bf0c134ab31c035d12aeca2d077c5837fa975af 100644 (file)
@@ -242,7 +242,13 @@ class mailAccount extends plugin
 
     /* Do we need to flip is_account state? */
     if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
+
+      /* Onyl change account state if allowed */
+      if($this->is_account && $this->acl == "#all#" && !$this->accountDelegationsConfigured()){
+        $this->is_account= !$this->is_account;
+      }elseif(!$this->is_account && chkacl($this->acl,"create") == ""){
+        $this->is_account= !$this->is_account;
+      }
     }
 
     /* Do we represent a valid account? */
@@ -625,6 +631,11 @@ class mailAccount extends plugin
         }
       }
     }
+    if(isset($this->parent->by_object['connectivity']->plugin['kolabAccount'])){
+      if($this->parent->by_object['connectivity']->plugin['kolabAccount']->is_account){
+        return(true);
+      }
+    }
     return(false); 
   }
 
index ba2fdeb1e1069e4863b5d31b6066b2aee13f74f5..3f06a241e0e9b3aca71f963aed6b4afae35e5b1c 100644 (file)
@@ -233,9 +233,13 @@ class posixAccount extends plugin
   }
 
   if(!$isCopyPaste){
+
+    $required = (isset($this->parent->by_object['sambaAccount']) && $this->parent->by_object['sambaAccount']->is_account) || 
+                (isset($this->parent->by_object['environment'] ) && $this->parent->by_object['environment'] ->is_account);
+
     /* Do we need to flip is_account state? */
     if (isset($_POST['modify_state'])){
-      if($this->is_account && $this->acl == "#all#"){
+      if($this->is_account && $this->acl == "#all#" && !$required ){
         $this->is_account= !$this->is_account;
       }elseif(!$this->is_account && chkacl($this->acl,"create") == ""){
         $this->is_account= !$this->is_account;
index 690ece7f51dae6268e5761f8c3e01d7fb0087b55..96513ee1b153daae1143618c646a0154adde1f6c 100644 (file)
@@ -193,13 +193,21 @@ class sambaAccount extends plugin
 
   function execute()
   {
-       /* Call parent execute */
-       plugin::execute();
+    /* Call parent execute */
+    plugin::execute();
+
 
     /* Do we need to flip is_account state? */
     if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
+
+      /* Only change account state if allowed */
+      if($this->is_account && $this->acl == "#all#"){
+        $this->is_account= !$this->is_account;
+      }elseif(!$this->is_account && chkacl($this->acl,"create") == ""){
+        $this->is_account= !$this->is_account;
+      }
     }
+
     /* Do we represent a valid account? */
     if (!$this->is_account && $this->parent == NULL){
       $display= "<img alt=\"\"src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".