Code

Fixed divlist acls for fai
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 2 Oct 2006 09:13:18 +0000 (09:13 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 2 Oct 2006 09:13:18 +0000 (09:13 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4843 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_divListFai.inc
plugins/admin/fai/class_faiManagement.inc

index 58cd27a8ee39639287d2c65264df8510381be70b..9dea993f8e0a207b37a2d8bd35c7b0a19c383ec7 100644 (file)
@@ -95,6 +95,7 @@ class divListFai extends MultiSelectWindow
 
   function GenHeader()
   {
+    $ui = get_userinfo();
     /* Prepare departments,
        which are shown in the listbox on top of the listbox
      */
@@ -125,32 +126,34 @@ class divListFai 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\" alt=\"\" align=\"middle\" height=\"16\" width=\"1\">&nbsp;".
-
-      " <input class='center' type='image' src='images/fai_new_profile.png' align='middle'
-      title='"._("New profile")."' name='Create_profile' alt='"._("P")."'>&nbsp;".
-
       "<img class='center' src=\"images/list_seperator.png\" alt=\"\" align=\"middle\" height=\"16\" width=\"1\">&nbsp;";
-      $listhead .= $this->get_snapshot_header($this->selectedBase);
-      $listhead .= " <input class='center' type='image' src='images/fai_new_partitionTable.png' align='middle'
-      title='"._("New partition table")."' name='Create_partition' alt='"._("PT")."'>&nbsp;".
 
-      " <input class='center' type='image' src='images/fai_new_script.png' align='middle'
-      title='"._("New scripts")."' name='Create_script' alt='"._("S")."'>&nbsp;".
+    $acl = $ui->get_permissions($this->selectedBase,"fai/faiProfile");
+    if(preg_match("/c/",$acl)){
+      $listhead .=" <input class='center' type='image' src='images/fai_new_profile.png' align='middle'
+        title='"._("New profile")."' name='Create_profile' alt='"._("P")."'>&nbsp;";
+    }
 
-      " <input class='center' type='image' src='images/fai_new_hook.png' align='middle'
-      title='"._("New hooks")."' name='Create_hook' alt='"._("H")."'>&nbsp;".
+    $listhead .= "<img class='center' src=\"images/list_seperator.png\" alt=\"\" align=\"middle\" height=\"16\" width=\"1\">&nbsp;";
+    $listhead .= $this->get_snapshot_header($this->selectedBase);
 
-      " <input class='center' type='image' src='images/fai_new_variable.png' align='middle'
-      title='"._("New variables")."' name='Create_variable' alt='"._("V")."'>&nbsp;".
 
-      " <input class='center' type='image' src='images/fai_new_template.png' align='middle'
-      title='"._("New templates")."' name='Create_template' alt='"._("T")."'>&nbsp;".
+    $arr = array(
+        array("images/fai_new_partitionTable.png" , _("New partition table")  ,"Create_partition" , _("PT") , "faiPartitionTable"),
+        array("images/fai_new_script.png"         , _("New scripts")          ,"Create_script"    , _("S")  , "faiScript"),
+        array("images/fai_new_hook.png"           , _("New hooks")            ,"Create_hook"      , _("H")  , "faiHook"),
+        array("images/fai_new_variable.png"       , _("New variables")        ,"Create_variable"  , _("V")  , "faiVariable"),
+        array("images/fai_new_template.png"       , _("New templates ")       ,"Create_template"  , _("I")  , "faiTemplate"),
+        array("images/fai_new_packages.png"       , _("New package list")     ,"Create_package"   , _("PK") , "faiPackage"));
 
-      " <input class='center' type='image' src='images/fai_new_packages.png' align='middle'
-      title='"._("New package list")."' name='Create_package' alt='"._("PK")."'>&nbsp;".
+    foreach($arr as $ar){
 
-      " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
+      $acl = $ui->get_permissions($this->selectedBase,"fai/".$ar[4]);
+      if(preg_match("/c/",$acl)){
+        $listhead .=" <input class='center' type='image' src='".$ar[0]."' align='middle' title='".$ar[1]."' name='".$ar[2]."' alt='".$ar[3]."'>&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;".
@@ -217,21 +220,28 @@ _("Submit")."'>&nbsp;".
          $desc= "";
        }
 
+
        if($value['FAIstate'] == "freeze"){
-         $action= "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
+         $action=  "<img src='images/closedlock.png' alt='F' class='center'><img src='images/empty.png' width='38' height='2' class='center' alt=''>";
+         $action.= "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
            name='entry_edit_%KEY%' title='"._("Edit class")."'>";
-         $edi = $editlink;
-         $acti = $action;
        }else{
          $action= "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
            name='entry_edit_%KEY%' title='"._("Edit class")."'>";
-         $action.= $this->GetSnapShotActions($value['dn']);;
-         $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
-           name='entry_delete_%KEY%' title='"._("Delete class")."'>";
-         $acti = $action;
-         $edi = $editlink;
+
+         if(preg_match("/(c&w)/",$value['acl'])){
+           $action.= $this->GetSnapShotActions($value['dn']);;
+         }
+
+         if(preg_match("/d/",$value['acl'])){
+           $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
+             name='entry_delete_%KEY%' title='"._("Delete class")."'>";
+         }
        }
 
+       $edi = $editlink;
+       $acti = $action;
+
        $field1 = array("string" => $img , "attach" => "style='text-align:center;width:20px;'");
        $field2 = array("string" => preg_replace(array("/%KEY%/","/%NAME%/","/%TITLE%/"),array($key,$value['cn'].$desc,preg_replace('/ /', '&nbsp;', @LDAP::fix($value['dn']))),$edi) , "attach" => "style=''");
        $field3 = array("string" => $info, "attach" => "style='width:200px;'");
index 1bcc95816fea23ddbbd01a7cca4dc65bc5dfd0c3..098cde7ab05a8abef1ecd08b669d392d13aa4479 100644 (file)
@@ -703,21 +703,28 @@ class faiManagement extends plugin
 
     $this->lock_type = get_release_tag(get_release_dn($base));
 
-    /* Get resolved release dependencies */
-    $tmp = get_all_objects_for_given_base($base,"(&(|(objectClass=FAIpartitionTable)(objectClass=FAIpackageList)(objectClass=FAIscript)
-      (objectClass=FAIvariable)(objectClass=FAIhook)(objectClass=FAIprofile)(objectClass=FAItemplate))(cn=$Regex))");
-
     /* Create a new list of FAI object 
      * Generate List of Partitions,Hooks,Scripts,Templates,Profiles ... 
      */
     $ObjectTypes = array(
-        "FAIpartitionTable"  => array("OU"=>"ou=disk,"        , "CHKBOX"=>"ShowPartitions"),
-        "FAIpackageList"     => array("OU"=>"ou=packages,"    , "CHKBOX"=>"ShowPackages"),
-        "FAIscript"          => array("OU"=>"ou=scripts,"     , "CHKBOX"=>"ShowScripts"),
-        "FAIvariable"        => array("OU"=>"ou=variables,"   , "CHKBOX"=>"ShowVariables"),
-        "FAIhook"            => array("OU"=>"ou=hooks,"       , "CHKBOX"=>"ShowHooks"),
-        "FAIprofile"         => array("OU"=>"ou=profiles,"    , "CHKBOX"=>"ShowProfiles"),
-        "FAItemplate"        => array("OU"=>"ou=templates,"   , "CHKBOX"=>"ShowTemplates"));
+        "FAIpartitionTable"  => array("OU"=>"ou=disk,"        , "CHKBOX"=>"ShowPartitions"  ,"ACL" => "faiPartitionTable"),
+        "FAIpackageList"     => array("OU"=>"ou=packages,"    , "CHKBOX"=>"ShowPackages"    ,"ACL" => "faiPackage"),
+        "FAIscript"          => array("OU"=>"ou=scripts,"     , "CHKBOX"=>"ShowScripts"     ,"ACL" => "faiScript"),
+        "FAIvariable"        => array("OU"=>"ou=variables,"   , "CHKBOX"=>"ShowVariables"   ,"ACL" => "faiVariable"),
+        "FAIhook"            => array("OU"=>"ou=hooks,"       , "CHKBOX"=>"ShowHooks"       ,"ACL" => "faiHook"),
+        "FAIprofile"         => array("OU"=>"ou=profiles,"    , "CHKBOX"=>"ShowProfiles"    ,"ACL" => "faiProfile"),
+        "FAItemplate"        => array("OU"=>"ou=templates,"   , "CHKBOX"=>"ShowTemplates"   ,"ACL" => "faiTemplate"));
+
+    $filter = "";
+    foreach($ObjectTypes as $key => $data){
+      if($this->DivListFai->$data['CHKBOX']){
+        $filter.= "(objectClass=".$key.")";
+      }
+    }
+    $filter = "(&(|".$filter.")(cn=$Regex))";
+    
+    /* Get resolved release dependencies */
+    $tmp = get_all_objects_for_given_base($base,$filter);
 
     /* Ge listed ldap objects */
     $ldap = $this->config->get_ldap_link();
@@ -731,12 +738,9 @@ class faiManagement extends plugin
       /* Walk through possible types */
       foreach($ObjectTypes as $type => $rest){  
 
-        /* Skip all unchecked types */
-        if(! $this->DivListFai->$rest['CHKBOX']){
-          continue;
-        }
+        $acl = $this->ui->get_permissions($object['dn'],"fai/".$rest ['ACL']);
 
-        if(in_array($type,$object['objectClass'])){
+        if(in_array($type,$object['objectClass']) && preg_match("/r/",$acl)){
 
           /* Prepare object */
           unset($object['objectClass']['count']);
@@ -748,6 +752,7 @@ class faiManagement extends plugin
           $obj                  = array();
           $obj['cn']                         = $object['cn'][0];
           $obj['dn']                         = $object['dn'];
+          $obj['acl']                      = $acl;
           $obj['description']   = $object['description'][0];
           $obj['objectClass']   = $object['objectClass'];