From 640b2ded1efaf5732e5cdfdcbf29ea0429a651de Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 12 Jul 2006 13:26:53 +0000 Subject: [PATCH] * Updated acl - no functional yet * 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 | 35 ++++++++++++------- include/class_pluglist.inc | 11 ++++-- include/functions.inc | 18 ++++++++++ .../departments/class_departmentGeneric.inc | 14 ++++++++ .../class_departmentManagement.inc | 13 ------- 5 files changed, 63 insertions(+), 28 deletions(-) diff --git a/include/class_acl.inc b/include/class_acl.inc index e5b604bc4..89d443ab5 100644 --- a/include/class_acl.inc +++ b/include/class_acl.inc @@ -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.= ','; } } diff --git a/include/class_pluglist.inc b/include/class_pluglist.inc index 4cd8786c4..81048f148 100644 --- a/include/class_pluglist.inc +++ b/include/class_pluglist.inc @@ -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); } diff --git a/include/functions.inc b/include/functions.inc index 899aadb8d..7d731c918 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -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: ?> diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc index 9206228a0..56476efcb 100644 --- a/plugins/admin/departments/class_departmentGeneric.inc +++ b/plugins/admin/departments/class_departmentGeneric.inc @@ -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: ?> diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc index 815f40da2..99f784c5a 100644 --- a/plugins/admin/departments/class_departmentManagement.inc +++ b/plugins/admin/departments/class_departmentManagement.inc @@ -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: ?> -- 2.30.2