phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [19020] Fix the get_accounts_at_location function.


From: Caeies
Subject: [Phpgroupware-cvs] [19020] Fix the get_accounts_at_location function.
Date: Wed, 07 Jan 2009 18:02:48 +0000

Revision: 19020
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=19020
Author:   Caeies
Date:     2009-01-07 18:02:47 +0000 (Wed, 07 Jan 2009)

Log Message:
-----------
Fix the get_accounts_at_location function. Not sure it is ok for all db. Please 
test it, and fix it if it's not the case

Modified Paths:
--------------
    core/trunk/phpgwapi/inc/class.acl.inc.php

Modified: core/trunk/phpgwapi/inc/class.acl.inc.php
===================================================================
--- core/trunk/phpgwapi/inc/class.acl.inc.php   2008-12-10 17:52:03 UTC (rev 
19019)
+++ core/trunk/phpgwapi/inc/class.acl.inc.php   2009-01-07 18:02:47 UTC (rev 
19020)
@@ -1262,6 +1262,7 @@
                        {
                                $appname = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        }
+                       $app_id = 
$GLOBALS['phpgw']->applications->name2id($appname);
 
                        if($grantor > 0)
                        {
@@ -1271,9 +1272,11 @@
                        {
                                $filter_grants = ' AND acl_grantor IS NULL';
                        }
+                       //XXX Caeies : Not sure that the IN (SELECT location_id 
from phpgw_locations WHERE app_id = '{$app_id}' AND name {$this->_like} 
'{$location}%') is portable for all supported db
+                       //Replacing it by a join is perhaps better ?
                        $sql = 'SELECT acl_account FROM phpgw_acl'
-                               . " WHERE acl_appname = '{$appname}'"
-                                       . " AND acl_location {$this->_like} 
'{$location}%' {$filter_grants}"
+                               . " WHERE location_id IN (SELECT location_id 
from phpgw_locations WHERE app_id = '{$app_id}' AND name {$this->_like} 
'{$location}%')"
+                                       . " {$filter_grants}"
                                        . " AND acl_type = '{$type}'"
                                . ' GROUP BY acl_account';
                        $this->_db->query($sql, __LINE__, __FILE__);






reply via email to

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