fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [11151] property: bypass acl at entity


From: Sigurd Nes
Subject: [Fmsystem-commits] [11151] property: bypass acl at entity
Date: Wed, 05 Jun 2013 16:44:30 +0000

Revision: 11151
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11151
Author:   sigurdne
Date:     2013-06-05 16:44:30 +0000 (Wed, 05 Jun 2013)
Log Message:
-----------
property: bypass acl at entity

Modified Paths:
--------------
    trunk/property/inc/class.soentity.inc.php
    trunk/property/inc/hook_config.inc.php
    trunk/property/templates/base/config.tpl

Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php   2013-06-05 16:16:25 UTC (rev 
11150)
+++ trunk/property/inc/class.soentity.inc.php   2013-06-05 16:44:30 UTC (rev 
11151)
@@ -483,11 +483,19 @@
                                $where= 'AND';
                        }
 
+                       $bypass_acl_at_entity = false;
+                       if(isset($_config->config_data['bypass_acl_at_entity'])
+                               && 
is_array($_config->config_data['bypass_acl_at_entity'])
+                               && in_array($entity_id, 
$_config->config_data['bypass_acl_at_entity']))
+                       {
+                               $bypass_acl_at_entity = true;
+                       }
+
                        unset($_config);
 
                        if ($filter=='all')
                        {
-                               if (is_array($grants))
+                               if (is_array($grants) && !$bypass_acl_at_entity)
                                {
                                        foreach($grants as $user => $right)
                                        {
@@ -1208,11 +1216,19 @@
                                $where= 'AND';
                        }
 
+                       $bypass_acl_at_entity = false;
+                       if(isset($_config->config_data['bypass_acl_at_entity'])
+                               && 
is_array($_config->config_data['bypass_acl_at_entity'])
+                               && in_array($entity_id, 
$_config->config_data['bypass_acl_at_entity']))
+                       {
+                               $bypass_acl_at_entity = true;
+                       }
+
                        unset($_config);
 
                        if ($filter=='all')
                        {
-                               if (is_array($grants))
+                               if (is_array($grants) && !$bypass_acl_at_entity)
                                {
                                        foreach($grants as $user => $right)
                                        {

Modified: trunk/property/inc/hook_config.inc.php
===================================================================
--- trunk/property/inc/hook_config.inc.php      2013-06-05 16:16:25 UTC (rev 
11150)
+++ trunk/property/inc/hook_config.inc.php      2013-06-05 16:44:30 UTC (rev 
11151)
@@ -502,3 +502,31 @@
 
                return $out;
        }
+
+       /**
+       * Get HTML checkbox with entities to bypass ACL
+       *
+       * @param $config
+       * @return string HTML checkboxes to be placed in a table
+       */
+       function bypass_acl_at_entity($config)
+       {
+               $entity_list = 
execMethod('property.soadmin_entity.read',array('allrows' => true));
+
+               $acl_bypass = isset($config['bypass_acl_at_entity']) ? 
$config['bypass_acl_at_entity'] : array();
+               $out = '';
+               foreach ( $entity_list as $dummy => $entity)
+               {
+                       $checked = '';
+                       if ( in_array($entity['id'], $acl_bypass))
+                       {
+                               $checked = ' checked';
+                       }
+
+                       $out .=  <<<HTML
+                       <tr><td><input type="checkbox" 
name="newsettings[bypass_acl_at_entity][]" value="{$entity['id']}" 
{$checked}><label>{$entity['name']}</label></td></tr>
+HTML;
+               }
+               return $out;
+       }
+

Modified: trunk/property/templates/base/config.tpl
===================================================================
--- trunk/property/templates/base/config.tpl    2013-06-05 16:16:25 UTC (rev 
11150)
+++ trunk/property/templates/base/config.tpl    2013-06-05 16:44:30 UTC (rev 
11151)
@@ -461,7 +461,7 @@
                                </select>
                        </td>
                </tr>
-               <tr class="row_off">
+               <tr class="row_on">
                        <td>{lang_Bypass_ACL_for_accessing_tickets}.</td>
                        <td>
                                <select 
name="newsettings[bypass_acl_at_tickets]">
@@ -471,6 +471,17 @@
                        </td>
                </tr>
                <tr class="row_off">
+                       <td>{lang_Bypass_ACL_for_accessing_entities}.</td>
+                       <td>
+                               <!--to be able to blank the setting - need an 
empty value-->
+                               <input type = 'hidden' 
name="newsettings[bypass_acl_at_entity][]" value="">
+                               <table>
+                                       {hook_bypass_acl_at_entity}
+                               </table>
+                       </td>
+               </tr>
+
+               <tr class="row_on">
                        <td>{lang_Use_ACL_for_helpdesk_categories}.</td>
                        <td>
                                <select name="newsettings[acl_at_tts_category]">




reply via email to

[Prev in Thread] Current Thread [Next in Thread]