From 2a70ed205d41edca6ac4fe72d5932d88e7681d5c Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 20 Nov 2006 12:04:28 +0000 Subject: [PATCH] Fixed application creation problem git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5163 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../applications/class_applicationGeneric.inc | 12 +++++++ .../class_applicationManagement.inc | 20 +++++++++-- .../applications/class_divListApplication.inc | 35 +++++++++++-------- plugins/admin/applications/generic.tpl | 5 ++- 4 files changed, 54 insertions(+), 18 deletions(-) diff --git a/plugins/admin/applications/class_applicationGeneric.inc b/plugins/admin/applications/class_applicationGeneric.inc index 7cbc9280d..cbdd26c7a 100644 --- a/plugins/admin/applications/class_applicationGeneric.inc +++ b/plugins/admin/applications/class_applicationGeneric.inc @@ -283,8 +283,14 @@ class application extends plugin $this->gosaApplicationFlags= "[$flag]"; } + /* Remove current picture */ + if(isset($_POST['remove_picture'])){ + $this->set_picture(""); + } + /* Check for picture upload */ if (isset($_FILES['picture_file']['name']) && $_FILES['picture_file']['name'] != ""){ + if (!is_uploaded_file($_FILES['picture_file']['tmp_name'])) { print_red (_("The specified picture has not been uploaded correctly.")); } @@ -370,6 +376,12 @@ class application extends plugin $new_dn= $this->dn; } + + if($this->dn == "new"){ + $this->set_acl_base($this->base); + } + + /* Check acls to create a new application here */ $ui= get_userinfo(); if (!$this->acl_is_createable() && $this->dn == "new"){ $message[]= _("You have no permissions to create a application on this 'Base'."); diff --git a/plugins/admin/applications/class_applicationManagement.inc b/plugins/admin/applications/class_applicationManagement.inc index 5c88b5756..4ba527185 100644 --- a/plugins/admin/applications/class_applicationManagement.inc +++ b/plugins/admin/applications/class_applicationManagement.inc @@ -452,8 +452,15 @@ 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"); + + /* Check Acls */ + $acl_all= $this->ui->has_complete_category_acls($dn,"application"); + if(!preg_match("/(c.*w|w.*c)/",$acl_all)){ + return(""); + } + + $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); } @@ -462,7 +469,14 @@ 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); + + /* Check Acls */ + $acl_all= $this->ui->has_complete_category_acls($dn,"application"); + if(!preg_match("/(c.*w|w.*c)/",$acl_all)){ + return(""); + } + + $obj = new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $dn, "application"); $this->CopyPasteHandler->Cut($obj); } } diff --git a/plugins/admin/applications/class_divListApplication.inc b/plugins/admin/applications/class_divListApplication.inc index 29745ad82..b22d12646 100755 --- a/plugins/admin/applications/class_divListApplication.inc +++ b/plugins/admin/applications/class_divListApplication.inc @@ -101,7 +101,11 @@ class divListApplication extends MultiSelectWindow } /* Get copy & paste icon */ - if($this->parent->CopyPasteHandler){ + $ui = get_userinfo(); + $acl = $ui->get_permissions("cn=dummy,".$this->selectedBase,"application/application"); + $acl_all= $ui->has_complete_category_acls($this->selectedBase,"application"); + + if((preg_match("/(c.*w|w.*c)/",$acl_all)) && ($this->parent->CopyPasteHandler)){ $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon(); }else{ $Copy_Paste =""; @@ -110,8 +114,6 @@ class divListApplication extends MultiSelectWindow /* Create listhead, it will be shown on top of the divlist. * It provides general navigation and object creation */ - $ui = get_userinfo(); - $acl = $ui->get_permissions("cn=dummy,".$this->selectedBase,"application/application"); $listhead = "
". "  ". @@ -122,7 +124,12 @@ class divListApplication extends MultiSelectWindow "  ". "  "; - $listhead .= $this->get_snapshot_header($this->selectedBase); + + if(preg_match("/(c.*w|w.*c)/",$acl_all)){ + $listhead .= $this->get_snapshot_header($this->selectedBase); + }else{ + $listhead .= " "; + } if(preg_match("/c/",$acl)){ $listhead .= " $val){ $acl = $ui->get_permissions($val['dn'],"application/application"); + $acl_all= $ui->has_complete_category_acls($val['dn'],"application"); /* Create action icons */ $actions= ""; - /* Add Copy & Paste icon */ - if($this->parent->CopyPasteHandler){ - + if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){ /* Only add cut icon, if we are allowed to move this user */ if(preg_match("/m/",$acl)){ $actions.= " "; - }else{ - $actions.= " "; - } - /* Copy is allowed everytime */ - $actions.= " "; + $actions.= " "; + } } /* Add edit icon */ $actions.= ""; - $actions.= $this->GetSnapShotActions($val['dn']); + + + if(preg_match("/(c.*w|w.*c)/",$acl_all)){ + $actions.= $this->GetSnapShotActions($val['dn']); + } /* If we are allowed to remove the application account, display remove icon */ if(preg_match("/d/",$acl)){ diff --git a/plugins/admin/applications/generic.tpl b/plugins/admin/applications/generic.tpl index 6b57f9a44..9da9a8d56 100644 --- a/plugins/admin/applications/generic.tpl +++ b/plugins/admin/applications/generic.tpl @@ -75,7 +75,10 @@ {/render} {render acl=$gosaApplicationIconACL} - + +{/render} +{render acl=$gosaApplicationIconACL} + {/render} -- 2.30.2