"new method acl::get_location_grants(), jaytraxx was missing ;-)"

This commit is contained in:
Ralf Becker 2009-12-07 12:36:25 +00:00
parent 699e66a1ce
commit c772e1d57d

View File

@ -735,4 +735,29 @@ class acl
),__LINE__,__FILE__);
}
}
/**
* get the locations for an app (excluding the run location !!!)
*
* @param string $location location, can contain wildcards % or ?
* @param string $app app optional defaults to $GLOBALS['egw_info']['flags']['currentapp'];
* @return array with location => array(account => rights) pairs
*/
function get_location_grants($location,$app='')
{
if (!$app) $app = $GLOBALS['egw_info']['flags']['currentapp'];
$locations = array();
foreach($this->db->select(acl::TABLE,'acl_location,acl_account,acl_rights',array(
'acl_appname' => $app,
'acl_location LIKE '.$this->db->quote($location),
),__LINE__,__FILE__) as $row)
{
if (($location = $row['acl_location']) != 'run')
{
$locations[$location][$row['acl_account']] = $row['acl_rights'];
}
}
return $locations;
}
} //end of acl class