Code

Updated object acl checks
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 27 May 2008 10:25:29 +0000 (10:25 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 27 May 2008 10:25:29 +0000 (10:25 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11025 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/groups/class_divListGroup.inc
gosa-core/plugins/admin/users/class_divListUsers.inc

index 0b6e1c30e1967c0acff9e86418274df20dd24c22..6c3304f2b8a8088126ec0c1f94040b9f0d9dfc4a 100644 (file)
@@ -164,8 +164,7 @@ class divListGroup extends MultiSelectWindow
     }
   
     /* Get acls */
-    $acls   = $ui->get_permissions($this->selectedBase,"groups/group");
-    $acl_all= $ui->has_complete_category_acls($this->selectedBase,"groups");
+    $acl   = $ui->get_permissions($this->selectedBase,"groups/group");
 
 
     /* Add default header */
@@ -176,15 +175,13 @@ class divListGroup extends MultiSelectWindow
       " <input type='image' class='center' src='images/lists/submit.png' title='"._("Submit department")."' name='submit_department' alt='"._("Submit").
       "'>&nbsp;";
 
-
-        /* Create Layers menu */
+    /* Create Layers menu */
     $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/lists/new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
 
     /* Append create options */
-    if(preg_match("/c/",$acl_all)) {
+    if(preg_match("/c/",$acl)) {
+      $s .= "..|<img src='images/lists/new.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Create")."|\n";
       $s.= "...|<input class='center' type='image' src='plugins/groups/images/new.png' alt=''>".
         "&nbsp;"._("Group")."|group_new|\n";
     }
@@ -208,20 +205,24 @@ class divListGroup extends MultiSelectWindow
     }
 
     /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s.= "..|---|\n";
+    $acl_all= $ui->has_complete_category_acls($this->selectedBase,"groups");
+
+    if(is_object($this->parent->CopyPasteHandler) && preg_match("/r/",$acl_all)){
       $s.= "..|<img src='images/lists/copy.png' alt='' border='0' class='center'>".
         "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+    }
+    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(r.*d|d.*r)/",$acl_all)){ 
       $s.= "..|<img src='images/lists/cut.png' alt='' border='0' class='center'>".
         "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+    }
 
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/lists/paste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/lists/paste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
+    /* Copy & paste icons */
+    if(is_object($this->parent->CopyPasteHandler) && $this->parent->CopyPasteHandler->entries_queued()){
+      $img = "<img border='0' class='center' src='images/lists/paste.png' alt=''>";
+      $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+    }else{
+      $img = "<img border='0' class='center' src='images/lists/paste-grey.png' alt=''>";
+      $s.="..|".$img."&nbsp;"._("Paste")."\n";
     }
 
     /* Add snapshot icons */
@@ -295,14 +296,21 @@ class divListGroup extends MultiSelectWindow
     
       /* Create action icons - copy & paste icons */
       $acl = $ui->get_permissions($val['dn'],"groups/group");
-      $acl_all= $ui->has_complete_category_acls($val['dn'],"groups");
+      $acl_all  = $ui->has_complete_category_acls($val['dn'],"groups");
 
       $actions= "";
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+      if(preg_match("/(r.*d|r.*d)/",$acl_all) && $this->parent->CopyPasteHandler){
         $actions.= "<input class='center' type='image'
           src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+      }else{
+        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
+      }
+
+      if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
         $actions.= "<input class='center' type='image'
           src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }else{
+        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
       /* Add edit icon */
@@ -310,16 +318,21 @@ class divListGroup extends MultiSelectWindow
         src='images/lists/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
 
       /* Add snapshot functionality */
-      if(preg_match("/(c.*w|w.*c)/", $acl_all)){
+      if(preg_match("/(r.*w|w.*r)/",$acl_all)){
         $actions.= $this->GetSnapShotActions($val['dn']);
+      }else{
+        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
+        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
       if(preg_match("/d/",$acl)){
         $actions.= "<input class='center' type='image'
           src='images/lists/trash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
+      }else{
+        $actions.= "<img class='center' src='images/empty.png' alt='&nbsp;'
+          title='"._("Not allowed")."'>";
       }
 
-
       $posix=$mail=$samba=$appl=$phone=$enviro=$empty;
 
       if(isset($val['objectClass'])){
index ea408b79eb75024f6b64c08a007c5e876c320933..e8da8760bf57775ac86ecb1d9705611a77625c31 100644 (file)
@@ -154,6 +154,7 @@ class divListUsers extends MultiSelectWindow
 
     /* Get copy & paste icon */
     $acl      = $ui->get_permissions($this->selectedBase,"users/user");
+    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"users");
 
     /* Add default header */
     $listhead = MultiSelectWindow::get_default_header();
@@ -198,8 +199,6 @@ class divListUsers extends MultiSelectWindow
       }
     }
 
-    /* Add multiple copy & cut icons */
-    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"users");
 
     if(is_object($this->parent->CopyPasteHandler) && preg_match("/r/",$acl_all)){
       $s.= "..|---|\n";
@@ -307,14 +306,16 @@ class divListUsers extends MultiSelectWindow
 
       /* Add copy & cut icons */     
       $acl      = $ui->get_permissions($val['dn'],"users/user");
-      if(preg_match("/(r.*d|r.*d)/",$acl) && $this->parent->CopyPasteHandler){
+      $acl_all  = $ui->has_complete_category_acls($val['dn'],"users");
+     
+      if(preg_match("/(r.*d|r.*d)/",$acl_all) && $this->parent->CopyPasteHandler){
         $action .= "<input class='center' type='image'
           src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
       }else{
         $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
-      if(preg_match("/r/",$acl) && $this->parent->CopyPasteHandler){
+      if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
         $action.= "<input class='center' type='image'
           src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
       }else{
@@ -341,7 +342,7 @@ class divListUsers extends MultiSelectWindow
         name='user_edit_%KEY%' title='".msgPool::editButton(_("user"))."'>";
 
       /* Add deactivate status if we are allowed to */
-      if (preg_match("/w/",$acl)){
+      if (preg_match("/w/",$ui->get_permissions($val['dn'],"users/password"))){
         $action.= $lock_status;
       }else{
         $action.="<img src='images/empty.png' alt=' ' class='center'>";
@@ -357,7 +358,7 @@ class divListUsers extends MultiSelectWindow
       }
 
       /* Add snapshot icon */
-      if(preg_match("/(r.*w|w.*r)/",$acl)){
+      if(preg_match("/(r.*w|w.*r)/",$acl_all)){
         $action.= $this->GetSnapShotActions($val['dn']);
       }else{
         $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
@@ -365,7 +366,7 @@ class divListUsers extends MultiSelectWindow
       }
 
       /* Add remove icon, if we are allowed to remove the current user */
-      if(preg_match("/d/",$ui->get_permissions($val['dn'],"users/user"))) {
+      if(preg_match("/d/",$acl)) {
         $action.= "<input class='center' type='image' src='images/lists/trash.png' alt='"._("delete")."'
           name='user_del_%KEY%' title='"._("Delete user")."'>";
       }else{