X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fapplications%2Fclass_applicationManagement.inc;h=801ca3fe6268847ea647622a53ecf8b47b7f3b13;hb=77e94f517b0910562a0548141c3d5c82366e19fb;hp=9df2492d1c16c1a278de64e7233f92f8222ec31a;hpb=f6caa814c762f74b718a839c06d63af1ebdf13be;p=gosa.git diff --git a/plugins/admin/applications/class_applicationManagement.inc b/plugins/admin/applications/class_applicationManagement.inc index 9df2492d1..801ca3fe6 100644 --- a/plugins/admin/applications/class_applicationManagement.inc +++ b/plugins/admin/applications/class_applicationManagement.inc @@ -31,9 +31,18 @@ class applicationManagement extends plugin var $CopyPasteHandler = NULL; var $DivListApplication = NULL; var $applications = array(); - var $acl = ""; var $enableReleaseManagement = false; + function IsReleaseManagementActivated() + { + /* Check if we should enable the release selection */ + $tmp = search_config($this->config->data,"faiManagement","CLASS"); + if(!empty($tmp)){ + return(true); + } + return(false); + } + function applicationManagement ($config, $ui) { /* Save configuration for internal use */ @@ -48,9 +57,8 @@ class applicationManagement extends plugin /* Creat dialog object */ $this->DivListApplication = new divListApplication($this->config,$this); + if($this->IsReleaseManagementActivated()){ /* Check if we should enable the release selection */ - $tmp = search_config($this->config->data,"faiManagement","CLASS"); - if(!empty($tmp)){ $this->enableReleaseManagement = true; /* Hide SubSearch checkbox */ @@ -63,7 +71,7 @@ class applicationManagement extends plugin $ldap = $this->config->get_ldap_link(); $dn = "ou=apps,".$base; $ret = array(); - $ret [$base] = "/"; + $ret ["ou=apps,".$base] = "/"; $ldap->cd($dn); $ldap->search("objectClass=organizationalUnit",array("ou")); @@ -162,9 +170,8 @@ class applicationManagement extends plugin $this->dn= "new"; /* Create new usertab object */ - $this->apptabs= new apptabs($this->config, - $this->config->data['TABS']['APPSTABS'], $this->dn); - $this->apptabs->set_acl(array(':all')); + $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application"); + $this->apptabs->set_acl_base($this->DivListApplication->selectedBase); } @@ -188,7 +195,7 @@ class applicationManagement extends plugin /* Finish apps edit is triggered by the tabulator dialog, so the user wants to save edited data. Check and save at this point. */ - if ((isset($_POST['edit_finish'])) && (isset($this->apptabs->config))){ + if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->apptabs->config))){ /* Check tabs, will feed message array */ $this->apptabs->last= $this->apptabs->current; @@ -203,14 +210,16 @@ class applicationManagement extends plugin $this->apptabs->save(); gosa_log ("Application object'".$this->dn."' has been saved"); - /* Application has been saved successfully, remove lock from - LDAP. */ - if ($this->dn != "new"){ - del_lock ($this->dn); + if (!isset($_POST['edit_apply'])){ + /* Application has been saved successfully, remove lock from + LDAP. */ + if ($this->dn != "new"){ + del_lock ($this->dn); + } + unset ($this->apptabs); + $this->apptabs= NULL; + unset ($_SESSION['objectinfo']); } - unset ($this->apptabs); - $this->apptabs= NULL; - unset ($_SESSION['objectinfo']); } else { /* Ok. There seem to be errors regarding to the tab data, show message and continue as usual. */ @@ -239,13 +248,9 @@ class applicationManagement extends plugin above dialog */ add_lock ($this->dn, $this->ui->dn); - /* Set up the users ACL's for this 'dn' */ - $acl= get_permissions ($this->dn, $this->ui->subtreeACL); - /* Register apptabs to trigger edit dialog */ - $this->apptabs= new apptabs($this->config, - $this->config->data['TABS']['APPSTABS'], $this->dn); - $this->apptabs->set_acl($acl); + $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application"); + $this->apptabs->set_acl_base($this->dn); $_SESSION['objectinfo']= $this->dn; } @@ -262,10 +267,10 @@ class applicationManagement extends plugin /* Load permissions for selected 'dn' and check if we're allowed to remove this 'dn' */ - $acl= get_permissions ($this->dn, $this->ui->subtreeACL); - $this->acl= get_module_permission($acl, "application", $this->dn); - if (chkacl($this->acl, "delete") == ""){ + $ui = get_userinfo(); + $acl = $ui->get_permissions($this->dn ,"application/application"); + if(preg_match("/d/",$acl)){ /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */ if (($user= get_lock($this->dn)) != ""){ @@ -295,12 +300,14 @@ class applicationManagement extends plugin /* Some nice guy may send this as POST, so we've to check for the permissions again. */ - if (chkacl($this->acl, "delete") == ""){ + $ui = get_userinfo(); + $acl = $ui->get_permissions($this->dn ,"application/application"); + + if(preg_match("/d/",$acl)){ /* Delete request is permitted, perform LDAP action */ - $this->apptabs= new apptabs($this->config, - $this->config->data['TABS']['APPSTABS'], $this->dn); - $this->apptabs->set_acl(array($this->acl)); + $this->apptabs= new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $this->dn,"application"); + $this->apptabs->set_acl_base($this->dn); $this->apptabs->delete (); gosa_log ("Application object'".$this->dn."' has been removed"); unset ($this->apptabs); @@ -336,8 +343,12 @@ class applicationManagement extends plugin /* Don't show buttons if tab dialog requests this */ if (!$this->apptabs->by_object[$this->apptabs->current]->dialog){ $display.= "

\n"; - $display.= "\n"; + $display.= "\n"; $display.= " \n"; + if ($this->dn != "new"){ + $display.= "\n"; + $display.= " \n"; + } $display.= "\n"; $display.= "

"; } @@ -349,7 +360,14 @@ class applicationManagement extends plugin Dialog display ****************/ + /* Check if there is a snapshot dialog open */ + $base = $this->DivListApplication->selectedBase; + if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases($base))){ + return($str); + } + /* Display dialog with system list */ + $this->DivListApplication->parent = $this; $this->DivListApplication->execute(); $this->DivListApplication->AddDepartments($this->DivListApplication->selectedBase); $this->reload(); @@ -358,6 +376,16 @@ class applicationManagement extends plugin } + /* Return departments, that will be included within snapshot detection */ + function get_used_snapshot_bases(){ + if($this->DivListApplication->selectedRelease == "main"){ + return(array($this->DivListApplication->selectedBase)); + }else{ + return(array($this->DivListApplication->selectedRelease)); + } + } + + function reload() { $this->applications= array(); @@ -373,12 +401,12 @@ class applicationManagement extends plugin $Releases = $this->getReleases($base); if(!$this->enableReleaseManagement){ - $use_base = $base; + $use_base = "ou=apps,".$base; }else{ if(isset($Releases[$release])){ $use_base = $release; }else{ - $use_base = $base; + $use_base = "ou=apps,".$base; } } @@ -386,7 +414,7 @@ class applicationManagement extends plugin $Flags |= GL_SUBSEARCH; } - $res= get_list($Filter, $this->ui->subtreeACL,$use_base, array("cn","description","dn","objectClass"), $Flags); + $res= get_list($Filter, "application", $use_base, array("cn","description","dn","objectClass"), $Flags); foreach ($res as $val){ $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val; } @@ -424,9 +452,14 @@ class applicationManagement extends plugin if($s_action == "copy"){ $this->CopyPasteHandler->Clear(); $dn = $this->applications[$s_entry]['dn']; - $obj = new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $dn); - $objNew = new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], "new"); - $this->CopyPasteHandler->Copy($obj,$objNew); + + /* Check Acls */ + $acl_all= $this->ui->has_complete_category_acls($dn,"application"); + if(preg_match("/(c.*w|w.*c)/",$acl_all)){ + $obj = new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $dn, "application"); + $objNew = new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], "new","application"); + $this->CopyPasteHandler->Copy($obj,$objNew); + } } /* Copy current object to CopyHandler @@ -434,8 +467,13 @@ class applicationManagement extends plugin if($s_action == "cut"){ $this->CopyPasteHandler->Clear(); $dn = $this->applications[$s_entry]['dn']; - $obj = new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $dn); - $this->CopyPasteHandler->Cut($obj); + + /* Check Acls */ + $acl_all= $this->ui->has_complete_category_acls($dn,"application"); + if(preg_match("/(c.*w|w.*c)/",$acl_all)){ + $obj = new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $dn, "application"); + $this->CopyPasteHandler->Cut($obj); + } } } @@ -460,7 +498,6 @@ class applicationManagement extends plugin function check() {} function adapt_from_template($dn) {} function password_change_needed() {} - function show_header($button_text, $text, $disabled= FALSE) {} } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>