Fix in acl.inc library to fully support phpmyadmin (some scope issues needed to be...
authorbradymiller <bradymiller@users.sourceforge.net>
Fri, 28 Jun 2013 07:47:49 +0000 (28 00:47 -0700)
committerbradymiller <bradymiller@users.sourceforge.net>
Sun, 30 Jun 2013 23:31:24 +0000 (30 16:31 -0700)
library/acl.inc

index 4b5e9c9..8a5fbd9 100644 (file)
   //   portal     Patient Portal
   
   if (isset ($phpgacl_location)) {
-    include_once("$phpgacl_location/gacl.class.php");
+    $GLOBALS['phpgacl_location_global'] = $phpgacl_location;
+    require_once("$phpgacl_location/gacl.class.php");
     $gacl_object = new gacl();
     //DO NOT CHANGE BELOW VARIABLE
     $section_aro_value = 'users';
+    $GLOBALS['section_aro_value_global'] = $section_aro_value;
   }
 
 /**
  * Check if a user has a given type or types of access to an access control object.
+ *
+ * Globals that can use are:
+ *  $GLOBALS['phpgacl_location_global']
+ *  $GLOBALS['section_aro_value_global']
  * 
  * This function will check for access to the given ACO.
  * view    - The user may view but not add or modify entries
  *                    requested.
  */
   function acl_check($section, $value, $user = '', $return_value = '') {
-    global $gacl_object, $phpgacl_location, $section_aro_value;
     if (! $user) $user = $_SESSION['authUser'];
 
-    if ($phpgacl_location) {
+    if ($GLOBALS['phpgacl_location_global']) {
       // This will return all pertinent ACL's (including return_values and whether allow/deny)
       // Walk through them to assess for access
-      $acl_results = $gacl_object->acl_query($section, $value, $section_aro_value, $user,NULL,NULL,NULL,NULL,NULL,TRUE);
+      $gacl_object = new gacl();
+      $acl_results = $gacl_object->acl_query($section, $value, $GLOBALS['section_aro_value_global'], $user,NULL,NULL,NULL,NULL,NULL,TRUE);
       if (empty($acl_results)) {
         return FALSE; //deny access
       }