Code

Fixed user/group detection for environment tab
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 31 Aug 2006 11:32:52 +0000 (11:32 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 31 Aug 2006 11:32:52 +0000 (11:32 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4558 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/environment/class_environment.inc

index 55a9216a1efda8cb9550849fe17ce98bac5f4b41..338b8837f530eb8da52d1af37067519ec2f5e6b0 100644 (file)
@@ -197,11 +197,6 @@ class environment extends plugin
       $this->useProfile = false;
     }
 
-    /* Set to group environment if we editing a group */
-    if(!isset($this->parent)){
-      $this->is_group = true;
-    }
-
     /* Set resolutions */
     $this->gotoXResolutions = array("auto"=>_("auto"),
                                     "640x480"   =>  "640x480",
@@ -235,11 +230,27 @@ class environment extends plugin
 
   }
 
+
+  /* Detect type of edited object (user|group)*/
+  function detect_grouptype()
+  {
+    if((!isset($this->parent))&&(!$this->is_account)){
+      $this->is_group     = false;
+    }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
+      $this->is_group     = true;
+    }else{
+      $this->is_group     = false;
+    }
+  }
+
+
   function execute()
   {
     /* Call parent execute */
     plugin::execute();
 
+    $this->detect_grouptype();
+
     /* Fill templating stuff */
     $smarty= get_smarty();
     $display= "";
@@ -289,7 +300,6 @@ class environment extends plugin
        */
     }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
       $smarty->assign("is_account","true");
-      $this->is_group     = true;
       $this->uid          = $this->cn;
       $this->attrs['uid'] = $this->cn;
 
@@ -328,8 +338,6 @@ class environment extends plugin
        */
       $smarty->assign("is_account","true");
 
-      $this->is_group = false;
-
       /* Change state if needed */
       if (isset($_POST['modify_state'])){
         if(($this->acl_is_createable() && !$this->is_account) || 
@@ -908,6 +916,8 @@ class environment extends plugin
     /* Call common method to give check the hook */
     $message= plugin::check();
 
+    $this->detect_grouptype
+
     if(preg_match("/[^0-9]/",$this->gotoProfileQuota)) {
       $message[]=_("Please set a valid profile quota size.");
     } 
@@ -978,6 +988,8 @@ class environment extends plugin
      * 2.2 And each type has two modes, Admin (e.g. 'gotoUserAdminPrinter') and Normal 
      */
     
+    $this->detect_grouptype();
+
     if($this->add_del_printer_member_was_called){
 
       $types = array( "gotoUserPrinter"       => "AddUser",