Code

Updated acls
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 17 Jul 2006 07:56:16 +0000 (07:56 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 17 Jul 2006 07:56:16 +0000 (07:56 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4174 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_acl.inc
plugins/admin/departments/class_departmentGeneric.inc
plugins/admin/groups/class_groupGeneric.inc
plugins/personal/connectivity/class_connectivity.inc
plugins/personal/generic/class_user.inc

index 499fcc8cb2e06eff5977f57efb32a34c0571d8c8..637d0ca845565e65041801a856f09fe69013e66d 100644 (file)
@@ -98,34 +98,45 @@ class acl extends plugin
     } else {
       $oc=  $this->attrs['objectClass'];
     }
+
+
+    /* Extract available categories from plugin info list */
     foreach ($plist as $class => $acls){
-      if (isset($acls['plDescription'])){
-        /* Only feed categories */
-        if (isset($acls['plDepends']['description'])){
-          $this->aclObjects[$acls['plDepends']['objectClass']]= $acls['plDepends']['description'];
-        }
 
-        /* Additionally filter the classes we're interested in in "self edit" mode */
-        if (in_array_ics($acls['plDepends']['objectClass'], $oc)){
-          $this->myAclObjects[$class]= $acls['plDescription'];
+      /* Only feed categories */
+      if (isset($acls['plCategory'])){
+
+        /* Walk through supplied list and feed only translated categories */
+        foreach($acls['plCategory'] as $idx => $data){
+
+          /* Non numeric index means -> base object containing more informations */
+          if (preg_match('/^[0-9]+$/', $idx)){
+            if (!isset($this->ocMapping[$data])){
+              $this->ocMapping[$data]= array();
+              $this->ocMapping[$data][]= '0';
+            }
+            $this->ocMapping[$data][]= $class;
+          } else {
+            if (!isset($this->ocMapping[$idx])){
+              $this->ocMapping[$idx]= array();
+              $this->ocMapping[$idx][]= '0';
+            }
+            $this->ocMapping[$idx][]= $class;
+            $this->aclObjects[$idx]= $data['description'];
+
+            /* Additionally filter the classes we're interested in in "self edit" mode */
+            if (in_array_ics($data['objectClass'], $oc)){
+              $this->myAclObjects[$class]= $acls['plDescription'];
+            }
+          }
+
         }
       }
     }
 
-    /* Add category for all objects */
+    /* Sort categories */
     asort($this->aclObjects);
 
-    /* Generate mapping object */
-    foreach ($plist as $oc => $pl){
-      if (isset($pl['plDepends']['objectClass'])){
-        $class= $pl['plDepends']['objectClass'];
-        if (!isset($this->ocMapping[$class])){
-          $this->ocMapping[$class]= array();
-          $this->ocMapping[$class][]= '0';
-        }
-        $this->ocMapping[$class][]= $oc;
-      }
-    }
 
     /* Fill acl types */
     if ($this->isContainer){
@@ -352,19 +363,16 @@ class acl extends plugin
       $aclList->SetHeight(150);
 
       /* Add settings for all categories to the (permanent) list */
-      foreach ($this->aclObjects as $oc => $dsc){
+      foreach ($this->aclObjects as $section => $dsc){
         $summary= "";
-        foreach ($plist as $key => $plugin){
-          if (isset($plugin['plDepends']['objectClass']) && $plugin['plDepends']['objectClass'] == $oc &&
-              isset($this->aclContents[$key])){
-            if (count($this->aclContents[$key]) && isset($this->aclContents[$key][0]) &&
-                $this->aclContents[$key][0] != ""){
-              $summary.= "$key, ";
-              continue;
-            }
-            if (!isset($this->aclContents[$key][0]) && count($this->aclContents[$key])){
-              $summary.= "$key, ";
-            }
+        foreach($this->ocMapping[$section] as $oc){
+          if (isset($this->aclContents[$oc]) && count($this->aclContents[$oc]) && isset($this->aclContents[$oc][0]) &&
+              $this->aclContents[$oc][0] != ""){
+            $summary.= "$oc, ";
+            continue;
+          }
+          if (isset($this->aclContents[$oc]) && !isset($this->aclContents[$oc][0]) && count($this->aclContents[$oc])){
+            $summary.= "$oc, ";
           }
         }
 
@@ -377,8 +385,8 @@ class acl extends plugin
 
         $field1= array("string" => $dsc, "attach" => "style='width:100px'");
         $field2= array("string" => $summary);
-        $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='cat_edit_$oc' title='"._("Edit categories ACLs")."'>";
-        $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='cat_del_$oc' title='"._("Clear categories ACLs")."'>";
+        $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='cat_edit_$section' title='"._("Edit categories ACLs")."'>";
+        $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='cat_del_$section' title='"._("Clear categories ACLs")."'>";
         $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px'");
         $aclList->AddEntry(array($field1, $field2, $field3));
       }
@@ -421,13 +429,12 @@ class acl extends plugin
 
       /* Collect objects for selected category */
       $aclObjects= array();
-
-      foreach ($plist as $class => $acls){
-        if (isset($acls['plDepends']['objectClass']) && $acls['plDepends']['objectClass'] == $this->aclObject){
-          $aclObjects[$class]= $acls['plDescription'];
+      foreach ($this->ocMapping[$this->aclObject] as $idx => $class){
+        if ($idx == 0){
+          continue;
         }
+        $aclObjects[$class]= $plist[$class]['plDescription'];
       }
-
       $smarty->assign('aclSelector', $this->buildAclSelector($aclObjects));
     }
 
@@ -446,40 +453,12 @@ class acl extends plugin
     $plist= $tmp->info;
     asort($plist);
 
-    /* Generate global options */
-#    $key= "global";
-#    $display.= "<table style='width:100%;border:1px solid #C04040' cellspacing=0 cellpadding=2><tr><td style='background-color:#D88888;height:1.8em' colspan=$cols><b>"._("All objects of this category")."</b></td></tr>";
-#
-#    $spc= "&nbsp;&nbsp;";
-#    if ($this->isContainer && $this->aclType != 'base'){
-#      $options= $this->mkchkbx($key."_0_c",  _("Create objects"), preg_match('/c/', $currentAcl[0])).$spc;
-#      $options.= $this->mkchkbx($key."_0_m", _("Move objects"), preg_match('/m/', $currentAcl[0])).$spc;
-#      $options.= $this->mkchkbx($key."_0_d", _("Remove objects"), preg_match('/d/', $currentAcl[0])).$spc;
-#      if ($plist[$key]['plSelfModify']){
-#        $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $currentAcl[0])).$spc;
-#      }
-#    } else {
-#      $options= $this->mkchkbx($key."_0_m", _("Move object"), preg_match('/m/', $currentAcl[0])).$spc;
-#      $options.= $this->mkchkbx($key."_0_d", _("Remove object"), preg_match('/d/', $currentAcl[0])).$spc;
-#      if ($plist[$key]['plSelfModify']){
-#        $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $currentAcl[0])).$spc;
-#      }
-#    }
-#
-#    /* Global options */
-#    $more_options= $this->mkchkbx($key."_0_r",  _("read"), preg_match('/r/', $currentAcl[0])).$spc;
-#    $more_options.= $this->mkchkbx($key."_0_w", _("write"), preg_match('/w/', $currentAcl[0]));
-#
-#    $display.= "<tr><td style='background-color:#E0E0E0' colspan=".($cols-1).">$options</td><td style='background-color:#D4D4D4'>&nbsp;".("Complete object:")." $more_options</td></tr></table><br>";
-    
     /* Build general objects */
     foreach ($list as $key => $name){
 
       /* Create sub acl if it does not exist */
       if (!isset($this->aclContents[$key])){
         $this->aclContents[$key]= array();
-      }
-      if (!isset($this->aclContents[$key][0])){
         $this->aclContents[$key][0]= '';
       }
       $currentAcl= $this->aclContents[$key];
@@ -512,7 +491,7 @@ class acl extends plugin
 
       /* Walk through the list of attributes */
       $cnt= 1;
-      $splist= $plist[$key];
+      $splist= $plist[$key]['plProvidedAcls'];
       asort($splist);
       foreach($splist as $attr => $dsc){
 
index 6e1f962f160ca60f386ef79acfc0074f90339dcc..cb42e5d272e16e63e5cb8c47135252da0120a5a1 100644 (file)
@@ -525,19 +525,26 @@ class department extends plugin
   /* Return plugin informations for acl handling */ 
   function plInfo()
   {
-    return (array("plDescription"     => _("Departments"),
-                  "plSelfModify"      => FALSE,
-                  "plDepends"         => array("objectClass" => "gosaDepartment", "description" => _("Departments")),
-                  "description"       => _("Description"),
-                  "c"                 => _("Country"),
-                  "l"                 => _("Location"),
-                  "telephoneNumber"   => _("Telephone"),
-                  "ou"                => _("Department name"),
-                  "businessCategory"  => _("Category"),
-                  "st"                => _("State"),
-                  "postalAddress"     => _("Address"),
-                  "gosaUnitTag"       => _("Administrative settings"),
-                  "facsimileTelephoneNumber" => _("Fax")));
+    return (array("plShortName"   => _("Generic"),
+                  "plDescription" => _("Departments"),
+                  "plSelfModify"  => FALSE,
+                  "plPriority"    => 0,
+                  "plDepends"     => array(),
+                  "plSection"     => array("admin"),
+                  "plCategory"    => array("department" => array("objectClass" => "gosaDepartment", "description" => _("Departments"))),
+            
+                  "plProvidedAcls" => array(
+                    "description"       => _("Description"),
+                    "c"                 => _("Country"),
+                    "l"                 => _("Location"),
+                    "telephoneNumber"   => _("Telephone"),
+                    "ou"                => _("Department name"),
+                    "businessCategory"  => _("Category"),
+                    "st"                => _("State"),
+                    "postalAddress"     => _("Address"),
+                    "gosaUnitTag"       => _("Administrative settings"),
+                    "facsimileTelephoneNumber" => _("Fax"))
+                  ));
   }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 33a7a5d51b691dbb605f3adf6edc26f9cbebb11c..3159f234b025d42bfdc872b452cea2b8e89807b3 100644 (file)
@@ -864,7 +864,7 @@ class group extends plugin
           "plDepends"     => array(),
           "plPriority"    => 0,
           "plSection"     => array("admin"),
-          "plCategory"    => array("groups" => _("Groups")),
+          "plCategory"    => array("groups" => array("objectClass" => "posixGroup", "description" => _("Groups"))),
 
           "plProvidedAcls"    => array(
             "cn"                => _("Name"),
index fbf45eef1de8828cad6a7ad8f01960a01f92259e..bd39d628bb64a357af4b3dc8d444206c19e1e97a 100644 (file)
@@ -175,7 +175,7 @@ class connectivity extends plugin
           "plDepends"         => array("user"),
           "plPriority"        => 5,                                 // Position in tabs
           "plSection"       => "personal",                        // This belongs to personal
-          "plCategory"      => array("gosaAccount"),
+          "plCategory"      => array("users"),
           "plOptions"       => array(),
           "plProvidedAcls"  => array(
             "connectivity"      => "!!! FIXME "._("Connectivity  account"))
index 5f12349d0ad91083591caae19e2a0419027ae381..700a3aeead304e0c7f44bc80c09e8129cd03313e 100644 (file)
@@ -1311,7 +1311,8 @@ class user extends plugin
         "plDepends"     => array(),
         "plPriority"    => 0,
         "plSection"     => array("personal" => _("My account")),
-        "plCategory"    => array("gosaAccount" => _("Users")),
+        "plCategory"    => array("users" => array("description" => _("Users"),
+                                                  "objectClass" => "gosaAccount")),
 
         "plProvidedAcls" => array(
           "userPassword"      => _("User password"),