X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_pluglist.inc;h=528052a875c054e5d28e3f98bd51f356a48c0b1e;hb=30d939bbc772a9b8cdd9704e8034101e957ab972;hp=d014c96a2c12f14284e7fcb2e2c9a96823929958;hpb=6b08ffcaafe0d9755aca07c6b9f624c3775c2dd0;p=gosa.git
diff --git a/gosa-core/include/class_pluglist.inc b/gosa-core/include/class_pluglist.inc
index d014c96a2..528052a87 100644
--- a/gosa-core/include/class_pluglist.inc
+++ b/gosa-core/include/class_pluglist.inc
@@ -31,6 +31,8 @@ class pluglist {
var $current= "";
var $info= array();
var $headlines = array();
+ var $allowed_plugins = array();
+ var $silly_cache= array();
function pluglist(&$config, &$ui)
{
@@ -38,17 +40,17 @@ class pluglist {
$this->config= &$config;
/* Create dirlist for all plugins */
- $this->dirlist= $this->get_plugins ($this->dirlist, $this->config->data);
+ $this->dirlist= $this->get_plugins ($this->dirlist, $this->config->data['MENU']);
- /* Fill info part of pluglist */
- $classes= get_declared_classes();
+ /* Fill info part of pluglist */
+ $classes= get_declared_classes();
- foreach ($classes as $cname){
- $cmethods = get_class_methods($cname);
- if (in_array_ics('plInfo',$cmethods)){
- $this->info[$cname]= @call_user_func(array($cname, 'plInfo'));
- }
- }
+ foreach ($classes as $cname){
+ $cmethods = get_class_methods($cname);
+ if (in_array_ics('plInfo',$cmethods)){
+ $this->info[$cname]= call_user_func(array($cname, 'plInfo'));
+ }
+ }
/* Provide field for 'all' */
$this->info['all']= array();
@@ -59,27 +61,41 @@ class pluglist {
function get_plugins($list, &$config)
{
- /* Error reporting, because I'm getting strange messages in PHP 4.2.x */
- if (!isset($config['PATH']) && !isset($config['CLASS'])){
+ global $class_mapping;
+
+ if (!isset($config['CLASS'])){
if (is_array($config)){
foreach ($config as $val){
$list= $this->get_plugins($list, $val);
}
}
} else {
- if (isset ($config['PATH']) && is_array($config)){
- $list[$this->index++]= $config['PATH'];
- if (isset($config['CLASS'])){
- $class= $config['CLASS'];
- }
+ if (is_array($config) && isset($class_mapping[$config['CLASS']])){
+ $list[$this->index++]= dirname($class_mapping[$config['CLASS']]);
+ } else {
+ $list[$this->index++]= "";
}
}
return ($list);
}
+
+ /*! \brief Check whether we are allowed to modify the given acl or not..
+ This function is used to check which plugins are visible.
+
+ @param The acl tag to test, eg. "users/user:self", "systems", ...
+ @return Boolean TRUE on success else FALSE
+ */
function check_access($aclname)
{
+ if (isset($this->silly_cache[$aclname])) {
+ return $this->silly_cache[$aclname];
+ }
+
+ /* Split given acl string into an array.
+ e.g. "user,systems" => array("users","systems");
+ */
$acls_to_check = array();
if(preg_match("/,/",$aclname)){
$acls_to_check = split(",",$aclname);
@@ -88,22 +104,34 @@ class pluglist {
}
foreach($acls_to_check as $acl_to_check){
- $deps = $this->ui->get_module_departments($acl_to_check);
- foreach($deps as $dep){
- if(preg_match("/\//",$acl_to_check)){
- if($this->ui->get_permissions($dep,$acl_to_check) != ""){
- return(TRUE);
- }
- }else{
- if($this->ui->get_category_permissions($dep,$acl_to_check) != ""){
- return(TRUE);
- }
+ $acl_to_check = trim($acl_to_check);
+
+ /* Check if the given acl tag is only valid for self acl entries
+
';
- if(session::get('js')){
- $current.= ''._($plHeadline).' '._($plDescription); - } else { - $current.= ''._($plHeadline).' '._($plDescription).''; - } - $current.= ' |