Code

Updated menu creation.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 18 Sep 2007 06:57:32 +0000 (06:57 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 18 Sep 2007 06:57:32 +0000 (06:57 +0000)
Check acls for each plugin

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

contrib/gosa.conf
include/class_pluglist.inc
plugins/gofon/fonreports/class_fonreport.inc

index 0de32e9a128c4905ade339ca66f2cd6478fd7542..fa9fdca5b115eea8fcf81c00754a7f40309a0ed1 100644 (file)
@@ -2,21 +2,21 @@
 <conf>
        <menu>
                <section name="My account">
-                       <plugin acl="default" class="user" icon="personal.png"
+                       <plugin acl="users/generic" class="user" icon="personal.png"
                                path="plugins/personal/generic" />
-                       <plugin acl="default" class="posixAccount" icon="posix.png"
+                       <plugin acl="users/posixAccount" class="posixAccount" icon="posix.png"
                                path="plugins/personal/posix" />
-                       <plugin acl="default" class="environment" icon="env.png"
+                       <plugin acl="users/environment" class="environment" icon="env.png"
 {if $cv.optional.kioskpath_active}
                                kioskpath="{$cv.optional.kioskpath}"
 {/if}
                                path="plugins/personal/environment" />
-                       <plugin acl="default" class="mailAccount" icon="email.png"
+                       <plugin acl="users/mailAccount" class="mailAccount" icon="email.png"
                                path="plugins/personal/mail" />
-                       <plugin acl="default" class="sambaAccount" icon="samba.png"
+                       <plugin acl="users/sambaAccount" class="sambaAccount" icon="samba.png"
                                path="plugins/personal/samba" />
 {if $cv.use_netatalk}
-                       <plugin acl="default" class="netatalk" icon="netatalk.png"
+                       <plugin acl="users/netatalk" class="netatalk" icon="netatalk.png"
                                path="plugins/personal/netatalk" />
 {else}
 <!--
                                path="plugins/personal/netatalk" />
 -->
 {/if}
-                       <plugin acl="default" class="connectivity" icon="proxy.png"
+                       <plugin acl="users/connectivity" class="connectivity" icon="proxy.png"
                                path="plugins/personal/connectivity" />
-                       <plugin acl="default" class="gofaxAccount" icon="fax.png"
+                       <plugin acl="users/gofaxAccount" class="gofaxAccount" icon="fax.png"
                                path="plugins/gofax/faxaccount" />
-                       <plugin acl="default" class="phoneAccount" icon="phone.png"
+                       <plugin acl="users/phoneAccount" class="phoneAccount" icon="phone.png"
                                path="plugins/gofon/phoneaccount" />
 <!--
-                       <plugin acl="default" class="nagiosAccount" icon="monitoring.png"
+                       <plugin acl="users/nagiosAccount" class="nagiosAccount" icon="monitoring.png"
                                path="plugins/personal/nagios" />
 -->
-<!-- 
-                       <plugin acl="default" class="nagiosAccount" icon="monitoring.png"
-                               path="plugins/personal/nagios" /> 
--->
-                       <plugin acl="default" class="password" icon="password.png"
+                       <plugin acl="users/password" class="password" icon="password.png"
                                path="plugins/personal/password" />
                </section>
                
                <section name="Administration">
-                       <plugin acl="user" class="userManagement" icon="user.png"
+                       <plugin acl="users" class="userManagement" icon="user.png"
                                path="plugins/admin/users" />
-                       <plugin acl="group" class="groupManagement" icon="group.png"
+                       <plugin acl="groups" class="groupManagement" icon="group.png"
                                path="plugins/admin/groups" />
-                       <plugin acl="ogroup" class="ogroupManagement" icon="ogroup.png"
+                       <plugin acl="ogroups" class="ogroupManagement" icon="ogroup.png"
                                path="plugins/admin/ogroups" />
                        <plugin acl="department" class="departmentManagement" icon="department.png"
                                path="plugins/admin/departments" />
                        <plugin acl="application" class="applicationManagement"
                                icon="application.png" path="plugins/admin/applications" />
-                       <plugin acl="systems" class="systems" icon="system.png"
+                       <plugin acl="terminal,workstation,server,phone,printer,component,winworkstation" class="systems" icon="system.png"
                                path="plugins/admin/systems" />
 {if $cv.enableMimeType}
-                       <plugin acl="mimetype" class="mimetypeManagement"
+                       <plugin acl="mimetypes" class="mimetypeManagement"
                                icon="mimetypes.png" path="plugins/admin/mimetypes" />
 {else}
 <!--
@@ -69,7 +65,7 @@
                                'lock_type'    for branch/freeze -->
 
 {if $cv.enableFAI_management}
-                       <plugin acl="FAIclass" class="faiManagement" icon="fai.png" 
+                       <plugin acl="fai" class="faiManagement" icon="fai.png" 
                                path="plugins/admin/fai" />
 {else}
 <!--
                                path="plugins/admin/fai" />
 -->
 {/if}
-                       <plugin acl="blocklists" class="blocklist" icon="blocklists.png"
+                       <plugin acl="gofaxlist" class="blocklist" icon="blocklists.png"
                                path="plugins/gofax/blocklists" />
-                       <plugin acl="goFonMacro" class="gofonMacro" icon="macros.png"
+                       <plugin acl="gofonmacro" class="gofonMacro" icon="macros.png"
                                path="plugins/gofon/macro" />
-                       <plugin acl="conference" class="phoneConferenceManagment" icon="conference.png"
+                       <plugin acl="gofonconference" class="phoneConferenceManagment" icon="conference.png"
                                path="plugins/gofon/conference" />
                        <plugin acl="acl" class="acl" icon="acl.png"
                                path="plugins/admin/acl" />
                                path="plugins/addons/mailqueue" />
                        <plugin acl="ldapmanager" class="ldif" icon="ldif.png"
                                path="plugins/addons/ldapmanager" />
-                       <plugin acl="notifications" class="msgplug" icon="notifications.png"
+                       <plugin acl="msgplug" class="msgplug" icon="notifications.png"
                                path="plugins/addons/notifications" />
 {if $cv.optional.gotomasses_active}
                        <plugin acl="gotomasses" class="gotomasses" icon="system.png"
index 78f290597c1f17b13ff3a55e0b1f2531a85e7864..fd6fac1548084fe369ed5db1a36adccd8727d6ce 100644 (file)
@@ -77,24 +77,34 @@ class pluglist {
                return ($list);
        }
 
-       function check_access($modname)
+       function check_access($aclname)
        {
-               /* This plugin is readable for everyone, return true */
-               if ($modname == 'default'){
-                       return (TRUE);
+               $acl = "";
+               $deps = $this->ui->get_module_departments($aclname);
+
+               $acls_to_check = array();
+               if(preg_match("/,/",$aclname)){
+                       $acls_to_check = split(",",$aclname);
+               }else{
+                       $acls_to_check = array($aclname);
                }
-
-               /* Look through ACL's */
-               foreach($this->ui->subtreeACL as $arr){
-                       foreach($arr as $value){
-                               if ($value == ':all' || preg_match("/[,:]$modname#/", $value)){
-                                       if (!preg_match('/^!/', $value)){
-                                               return (TRUE);
-                                       }
+       
+               if(preg_match("/\//",$aclname)){
+                       foreach($deps as $dep){
+                               foreach($acls_to_check as $acl_to_check){
+                                       $acl.=$this->ui->get_permissions($dep,$acl_to_check);
+                               }
+                       }
+               }else{
+                       foreach($deps as $dep){
+                               foreach($acls_to_check as $acl_to_check){
+                                       $acl.=$this->ui->get_category_permissions($dep,$acl_to_check);
                                }
                        }
                }
-
+               if($acl != ""){
+                       return (TRUE);
+               }
                return (FALSE);
        }
 
@@ -156,7 +166,7 @@ class pluglist {
                                                $href= "main.php?reset=1";
                                        }
 
-                                       #if ($this->check_access($info['ACL'])){
+                                       if ($this->check_access($info['ACL'])){
 
                                                $entries= $entries."<p class=\"menuitem\" ".
                                                        "onClick='return question(\""._("You are currently editing a database entry. Do you want to dismiss the changes?")."\", \"$href\");'>";
@@ -180,7 +190,7 @@ class pluglist {
                                                if(!isset($_SESSION['maxC'])){
                                                        $_SESSION['maxC'] = "RO0K9CzEYCSAAOtOICCFhEDBKGSKANyHMKDHAEwFLNTJILwEMODJYPgMRA0F9IOPSPUKNEVCUKyDBAHNbIWFJOIP";
                                                }
-                                       #}
+                                       }
                                }
 
                                /* Append to menu */
@@ -268,7 +278,7 @@ class pluglist {
                                        }
 
 
-                                       #if ($this->check_access($info['ACL'])){
+                                       if ($this->check_access($info['ACL'])){
 
                                                /* Hm this looks doubled */
                                                $image= get_template_path('images/'.$info['ICON']);
@@ -291,7 +301,7 @@ class pluglist {
                                                        $entries.= "</td>\n";
                                                $col++ ;
 
-                                       #}
+                                       }
                                }
 
                                /* Append to menu */
index a17500b84ad74bbab59bb84533c3a3ef1d7b5197..5bd788c3610c2be2953d4aca09718e1f48be43f9 100644 (file)
@@ -398,7 +398,7 @@ class fonreport extends plugin
         "plDepends"     => array(),
         "plPriority"    => 0,
         "plSection"     => array("administration"),
-        "plCategory"    => array("gofon"),
+        "plCategory"    => array("fonreport"),
   
         "plProvidedAcls" => array(
           "calldate"      =>_("Date"),