Code

Added acls to department selection
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Sep 2006 04:43:32 +0000 (04:43 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Sep 2006 04:43:32 +0000 (04:43 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4612 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/departments/class_departmentGeneric.inc
plugins/admin/departments/class_divListDepartment.inc

index 582a9edc2fee58869d7a338815e3c753a2854980..fb3ab679e640bb4fd85c6ae922d01163fe8b9559 100644 (file)
@@ -228,7 +228,7 @@ class department extends plugin
 
                /* Permissions for that base? */
                //      $this->dn= "ou=$this->ou,".$this->base;
-               if ($this->acl_is_createable() && $this->dn != "new"){
+               if ($this->acl_is_createable() && $this->dn == "new"){
                        $message[]= _("You have no permissions to create a department on this 'Base'.");
                }
 
index f83a561d11b6afb95852c4a9eb0cde788aa01d15..5bb5c9d6e3f0c3ecfd1207f65d9220dc7324e6c0 100755 (executable)
@@ -65,17 +65,32 @@ class divListDepartment extends MultiSelectWindow
     }
 
     /* Generate list head */
-      $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
-        " <input type='image' class='center' src='images/list_root.png' align='middle' title='"._("Go to root department")."' name='dep_root' alt='".       _("Root")."'>&nbsp;".
-        " <input type='image' class='center' src='images/list_up.png' align='middle' title='"._("Go up one department")."' name='dep_back' alt='"._("Up").  "'>&nbsp;".
-        " <input type='image' class='center' src='images/list_home.png' align='middle' title='"._("Go to users home department")."' name='dep_home' alt='". _("Home")."'>&nbsp;".
-        " <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;".
-        " <input class='center' type='image' src='images/list_new_department.png' align='middle' alt='"._("Create new department")."' name='dep_new'>&nbsp; ".
-        " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-        _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
-        " <input class='center' type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
-        "</div>";
+    $ui = get_userinfo();
+    $acl = $ui->get_permissions("ou=dummy,",$this->selectedBase  ,"department/department");
+
+    $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
+      " <input type='image' class='center' src='images/list_root.png' align='middle' ".
+      "   title='"._("Go to root department")."' name='dep_root' alt='".       _("Root")."'>&nbsp;".
+      " <input type='image' class='center' src='images/list_up.png' align='middle' ".
+      "   title='"._("Go up one department")."' name='dep_back' alt='"._("Up").  "'>&nbsp;".
+      " <input type='image' class='center' src='images/list_home.png' align='middle' ".
+      "   title='"._("Go to users home department")."' name='dep_home' alt='". _("Home")."'>&nbsp;".
+      " <input class='center' type='image' src='images/list_reload.png' align='middle' ".
+      "   title='"._("Reload list")."' name='submit_department' alt='".      _("Submit")."'>&nbsp;";
+      
+    if(preg_match("/c/",$acl)){
+      $listhead .=  " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
+        " <input class='center' type='image' src='images/list_new_department.png' ".
+        "   align='middle' alt='"._("Create new department")."' name='dep_new'>&nbsp; ";
+    }
+  
+
+    $listhead .= " <img class='center' src='images/list_seperator.png' align='middle' ".
+      " alt='' height='16' width='1'>&nbsp;".
+      " "._("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+      " <input class='center' type='image' src='images/list_submit.png' align='middle' ".
+      "   title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
+      "</div>";
 
     $this->SetListHeader($listhead);
   }
@@ -88,14 +103,24 @@ class divListDepartment extends MultiSelectWindow
 
   function setEntries($list)
   {
-    $actions= "<input class='center' type='image' src='images/edit.png'
-      alt='"._("edit")."'   name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
-    $actions.= "<input class='center' type='image' src='images/edittrash.png'
-      alt='"._("delete")."'   name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
-
     $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
 
+    $ui = get_userinfo();
     foreach($list as $key => $val) {
+
+      $actions= "";      
+
+      $acl = $ui->get_permissions($this->config->departments[$key] ,"department/department");
+      if(preg_match("/r/",$acl)){
+        $actions.= "<input class='center' type='image' src='images/edit.png'
+          alt='"._("edit")."'   name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
+      }
+
+      if(preg_match("/c/",$acl)){
+        $actions.= "<input class='center' type='image' src='images/edittrash.png'
+          alt='"._("delete")."'   name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
+      }
+
       if(!isset($this->config->departments[trim($key)])){
         $this->config->departments[trim($key)]="";
       }