Code

* Updated acl - no functional yet
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 12 Jul 2006 13:26:53 +0000 (13:26 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 12 Jul 2006 13:26:53 +0000 (13:26 +0000)
* modified pluglist to get hands on all classes with plInfo()

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4129 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_acl.inc
include/class_pluglist.inc
include/functions.inc
plugins/admin/departments/class_departmentGeneric.inc
plugins/admin/departments/class_departmentManagement.inc

index e5b604bc438f1a608e66ed7872c2ea5f941d808e..89d443ab571b659e60fc4eacc69a5a36f01d85a0 100644 (file)
@@ -253,7 +253,7 @@ class acl extends plugin
       }
     }
 
-    /* Store ACL in mail object? */
+    /* Store ACL in main object? */
     if (isset($_POST['submit_new_acl'])){
       $this->gosaAclEntry[$this->currentIndex]['type']= $this->aclType;
       $this->gosaAclEntry[$this->currentIndex]['members']= $this->recipients;
@@ -353,6 +353,10 @@ class acl extends plugin
             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, ";
             }
           }
         }
@@ -421,6 +425,7 @@ class acl extends plugin
 
     /* Show main page */
     $smarty->assign("dialogState", $this->dialogState);
+
     return ($smarty->fetch (get_template_path('acl.tpl')));
   }
 
@@ -650,7 +655,9 @@ class acl extends plugin
     if (isset($entry['acl'])){
       $acl= "";
       foreach ($entry['acl'] as $name => $object){
-        $acl.= "$name, ";
+        if (count($object)){
+          $acl.= "$name, ";
+        }
       }
       $summary.= sprintf(_("Contains settings for these objects: %s"), preg_replace('/, $/', '', $acl));
     }
@@ -721,19 +728,23 @@ class acl extends plugin
         $acl= ":";
         if (isset($entry['acl'])){
           foreach ($entry['acl'] as $object => $contents){
-            $acl.= $object.";";
-            
-            foreach($contents as $attr => $permission){
 
-              /* First entry? Its the one for global settings... */
-              if ($attr == '0'){
-                $acl.= $permission;
-              } else {
-                $acl.= '#'.$attr.';'.$permission;
-              }
+            /* Only save, if we've some contents in there... */
+            if (count($contents)){
+              $acl.= $object.";";
+
+              foreach($contents as $attr => $permission){
 
+                /* First entry? Its the one for global settings... */
+                if ($attr == '0'){
+                  $acl.= $permission;
+                } else {
+                  $acl.= '#'.$attr.';'.$permission;
+                }
+
+              }
+              $acl.= ',';
             }
-            $acl.= ',';
             
           }
         }
index 4cd8786c472a98dc3c6c3368c4cc1a8ef3d445e3..81048f1489f1ebbab93de532877844fa1e989752 100644 (file)
@@ -38,12 +38,19 @@ class pluglist {
 
                /* Create dirlist for all plugins */
                $this->dirlist= $this->get_plugins ($this->dirlist, $this->config->data);
+
+                /* Fill info part of pluglist */
+                $classes= get_declared_classes();
+                foreach (get_declared_classes() as $cname){
+                        if (method_exists($cname, 'plInfo')){
+                                $this->info[$cname]= @call_user_func(array($cname, 'plInfo'));
+                        }
+                }
        }
 
        function get_plugins($list, $config)
        {
                /* Error reporting, because I'm getting strange messages in PHP 4.2.x */
-               error_reporting(0);
                if (!isset($config['PATH']) && !isset($config['CLASS'])){
                        if (is_array($config)){
                                foreach ($config as $val){
@@ -55,11 +62,9 @@ class pluglist {
                                $list[$this->index++]= $config['PATH'];
                                if (isset($config['CLASS'])){
                                        $class= $config['CLASS'];
-                                       $this->info[$class]= call_user_func(array($class, 'plInfo'));
                                }
                        }
                }
-               error_reporting(E_ALL);
 
                return ($list);
        }
index 899aadb8dbe0c19d33313e32b7c524ceb99cd48b..7d731c918b43f5598deb84a1d8b039ec989b16c8 100644 (file)
@@ -2103,5 +2103,23 @@ function get_base_dir()
   return $BASE_DIR;
 }
 
+
+function obj_is_readable($dn, $object, $attribute)
+{
+  global $ui;
+
+  return preg_match('/r/', $ui->get_permissions($dn, $object, $attribute));
+}
+
+
+function obj_is_writable($dn, $object, $attribute)
+{
+  global $ui;
+
+  return preg_match('/w/', $ui->get_permissions($dn, $object, $attribute));
+}
+
+
+
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 9206228a0cdfb5e8439a61d96a33fdec6ac3b7ed..56476efcbf6138529ccc373e26cec58b12aee72d 100644 (file)
@@ -512,6 +512,20 @@ class department extends plugin
                }
        }
 
+
+  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") ));
+  }
+
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 815f40da2b874a87de132c048275da4bac52637c..99f784c5a7703751a5dafbe97cba54b6ec4d1211 100644 (file)
@@ -407,19 +407,6 @@ class departmentManagement extends plugin
     $this->DivListDepartment->save_object();
   }
 
-  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") ));
-  }
-
-  
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>