You are here

function acl_get_id_by_name in ACL 8

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

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

3 calls to acl_get_id_by_name()
AclMigrationTestTrait::testMigration in src/Tests/AclMigrationTestTrait.php
Tests migration of ACL List.
AclTest::testNodeAclCreateDelete in src/Tests/AclTest.php
Includes acl_create_acl, acl_delete_acl, acl_get_id_by_name
AclTest::testNodeAclSingleUserAddRemove in src/Tests/AclTest.php
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 223
An API module providing by-user access control lists.

Code

function acl_get_id_by_name($module, $name, $figure = NULL) {
  $query = \Drupal::database()
    ->select('acl', 'a')
    ->fields('a', [
    'acl_id',
  ])
    ->condition('a.module', $module)
    ->condition('a.name', $name);
  if (isset($figure)) {
    $query
      ->condition('a.figure', $figure);
  }
  return $query
    ->execute()
    ->fetchField();
}