From: hickert Date: Thu, 31 Aug 2006 11:32:52 +0000 (+0000) Subject: Fixed user/group detection for environment tab X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d96d6231744230ef3617f5870517158fffbd4848;p=gosa.git Fixed user/group detection for environment tab git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4558 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc index 55a9216a1..338b8837f 100644 --- a/plugins/personal/environment/class_environment.inc +++ b/plugins/personal/environment/class_environment.inc @@ -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",