Code

Fixed application creation problem
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 20 Nov 2006 12:04:28 +0000 (12:04 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 20 Nov 2006 12:04:28 +0000 (12:04 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5163 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/applications/class_applicationGeneric.inc
plugins/admin/applications/class_applicationManagement.inc
plugins/admin/applications/class_divListApplication.inc
plugins/admin/applications/generic.tpl

index 7cbc9280dc1fff0916953a3a72246c13ddf45bdb..cbdd26c7abe9d52ad0a12cf5cd6801fe10cc0d94 100644 (file)
@@ -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'.");
index 5c88b5756f006427b6c1e93bde3ad8544ca26c13..4ba527185a31917bb3082a4470931cb18cfe4a5e 100644 (file)
@@ -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);
     }
   }
index 29745ad82390aaafa1cd6fa98b88122c2b7c2a07..b22d12646dcb164e06e2b59f680e1dd311f53787 100755 (executable)
@@ -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 = "<div style='background:#F0F0F9;padding:5px;'>".
       " <input class='center' type='image' src='images/list_root.png' align='middle' ".
       "title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
@@ -122,7 +124,12 @@ class divListApplication extends MultiSelectWindow
       " <input class='center' type='image' src='images/list_reload.png' align='middle' ".
       "title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
       " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
-    $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 .= "<img class='center' src='images/restore_grey.png' alt=''>&nbsp;";
+    }
 
     if(preg_match("/c/",$acl)){
     $listhead .= " <input class='center' type='image' align='middle' src='images/list_new_app.png' alt='"._("new")."'
@@ -174,31 +181,31 @@ class divListApplication extends MultiSelectWindow
     foreach($list as $key => $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.= "<input class='center' type='image'
             src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        }else{
-          $actions.= "<img src='images/empty.png' alt='&nbsp;'>";
-        }
 
-        /* Copy is allowed everytime */
-        $actions.= "<input class='center' type='image'
-          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+          $actions.= "<input class='center' type='image'
+            src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+        }
       }
 
       /* Add edit icon */
       $actions.= "<input class='center' type='image'
         src='images/edit.png' alt='"._("edit")."' name='appl_edit_%KEY%' title='"._("Edit this entry")."'>";
-      $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)){
index 6b57f9a448705779f56017060bcdbb66a001a8b7..9da9a8d5653b879408c8d282e57455f880847781 100644 (file)
     <input name="picture_file" type="file" size="20" maxlength="255" accept="image/*.png" id="picture_file">
 {/render}
 {render acl=$gosaApplicationIconACL}
-    <input type="submit" name="update" value="{t}Update{/t}" title="{t}Reload picture from LDAP{/t}">
+<input type="submit" name="update" value="{t}Update{/t}" title="{t}Reload picture from LDAP{/t}">
+{/render}
+{render acl=$gosaApplicationIconACL}
+<input type="submit" name="remove_picture" value="{t}Remove picture{/t}" title="{t}Remove picture from LDAP{/t}">
 {/render}
     </td>
     </tr>