You are here

function acl_get_id_by_name in ACL 7

Same name and namespace in other branches
  1. 8 acl.module \acl_get_id_by_name()
  2. 5 acl.module \acl_get_id_by_name()
  3. 6 acl.module \acl_get_id_by_name()

Get the id of an ACL by name (+ optionally number).

2 calls to acl_get_id_by_name()
AclWebTestCase::testNodeAclCreateDelete in tests/acl.test
Includes acl_create_acl, acl_delete_acl, acl_get_id_by_name
AclWebTestCase::testNodeAclSingleUserAddRemove in tests/acl.test
Includes acl_add_user, acl_remove_user, acl_has_users, acl_get_id_by_name, acl_has_user, acl_get_uids

File

./acl.module, line 185
An API module providing by-user access control lists.

Code

function acl_get_id_by_name($module, $name, $number = NULL) {
  $query = db_select('acl', 'a')
    ->fields('a', array(
    'acl_id',
  ))
    ->condition('a.module', $module)
    ->condition('a.name', $name);
  if (isset($number)) {
    $query
      ->condition('a.number', $number);
  }
  return $query
    ->execute()
    ->fetchField();
}