X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_servRepository.inc;h=8b9329b12c5510d698347343b3b5badaee01a7d9;hb=dfa5fe6c803668ad23a8c44b6412f5d54d6d64b5;hp=295fe521418ad438e5403396c23bcb42e02c9767;hpb=91b6eb3224b410be65a609e3c8c79d05f3734e13;p=gosa.git diff --git a/plugins/admin/systems/class_servRepository.inc b/plugins/admin/systems/class_servRepository.inc index 295fe5214..8b9329b12 100644 --- a/plugins/admin/systems/class_servRepository.inc +++ b/plugins/admin/systems/class_servRepository.inc @@ -2,11 +2,6 @@ class servrepository extends plugin { - /* CLI vars */ - var $cli_summary = "Manage server basic objects"; - var $cli_description = "Some longer text\nfor help"; - var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser"); - /* attribute list for save action */ // var $ignore_account = TRUE; var $attributes = array("FAIrepository"); @@ -20,15 +15,25 @@ class servrepository extends plugin /* Repositories */ var $repositories = array(); - var $FAIrepository = array(); + var $FAIrepository = array(); + + var $fai_activated = FALSE; function servrepository ($config, $dn= NULL, $parent= NULL) { plugin::plugin ($config, $dn, $parent); + /* Skip this if fai is deactivated */ + $tmp = search_config($this->config->data,"faiManagement","CLASS"); + if(!empty($tmp)){ + $this->fai_activated = TRUE; + }else{ + return; + } + $ui = get_userinfo(); $tmp= get_permissions ($this->dn, $ui->subtreeACL); - $this->acl= get_module_permission($tmp, "FAIclass", $this->dn); + $this->acl= get_module_permission($tmp, "servrepository", $this->dn); $this->repositories = array(); if(isset($this->attrs['FAIrepository'])){ @@ -77,10 +82,21 @@ class servrepository extends plugin /* Call parent execute */ plugin::execute(); + if(!$this->fai_activated){ + $str = "

"._("You can't use this plugin until FAI is activated.")."

"; + return $str; + } + /* Fill templating stuff */ $smarty= get_smarty(); $display= ""; + $ui = get_userinfo(); + $tmp= get_permissions ($this->dn, $ui->subtreeACL); + $this->acl= get_module_permission($tmp, "servrepository", $this->dn); + $allow_edit = !preg_match("/disabled/i",chkacl($this->acl,"FAIclass")); + + /* Smarty vars*/ $smarty->assign("infoimage", get_template_path('images/info.png')); $smarty->assign("search_image", get_template_path('images/search.png')); @@ -93,7 +109,15 @@ class servrepository extends plugin /* 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; + $this->is_modified = true; + }elseif(!$this->is_account && chkacl($this->acl,"create") == ""){ + $this->is_account= !$this->is_account; + $this->is_modified = true; + } } /* Show tab dialog headers */ @@ -110,12 +134,6 @@ class servrepository extends plugin ADD / EDIT Repository Dialog Handling */ - - $ui = get_userinfo(); - $tmp= get_permissions ($this->dn, $ui->subtreeACL); - $this->acl= get_module_permission($tmp, "FAIclass", $this->dn); - $allow_edit = !preg_match("/disabled/i",chkacl($this->acl,"FAIclass")); - $once = false; if(isset($_POST['servRepository'])){ @@ -304,10 +322,13 @@ class servrepository extends plugin function remove_from_parent() { + + if(!$this->fai_activated) return; + /* Skip if not allowed */ $ui = get_userinfo(); $tmp= get_permissions ($this->dn, $ui->subtreeACL); - $this->acl= get_module_permission($tmp, "FAIclass", $this->dn); + $this->acl= get_module_permission($tmp, "servrepository", $this->dn); if(preg_match("/disabled/",chkacl($this->acl,"FAIclass"))) return; @@ -350,11 +371,12 @@ class servrepository extends plugin /* Save to LDAP */ function save() { - + if(!$this->fai_activated) return; + /* Skip if not allowed */ $ui = get_userinfo(); $tmp= get_permissions ($this->dn, $ui->subtreeACL); - $this->acl= get_module_permission($tmp, "FAIclass", $this->dn); + $this->acl= get_module_permission($tmp, "servrepository", $this->dn); if(preg_match("/disabled/",chkacl($this->acl,"FAIclass"))) return; plugin::save();