function acl_get_ids_by_user in ACL 7
Same name and namespace in other branches
- 8 acl.module \acl_get_ids_by_user()
Get an array of acl_ids held by a user.
File
- ./
acl.module, line 229 - An API module providing by-user access control lists.
Code
function acl_get_ids_by_user($module, $uid, $name = NULL, $number = NULL) {
$query = db_select('acl', 'a');
$query
->join('acl_user', 'au', 'a.acl_id = au.acl_id');
$query
->fields('a', array(
'acl_id',
))
->condition('a.module', $module)
->condition('au.uid', $uid);
if (isset($name)) {
$query
->condition('a.name', $name);
}
if (isset($number)) {
$query
->condition('a.number', $number);
}
$acl_ids = $query
->execute()
->fetchCol();
return $acl_ids;
}