You are here

function acl_create_acl in ACL 8

Same name and namespace in other branches
  1. 7 acl.module \acl_create_acl()

Create a new ACL.

The client module will have to keep track of the ACL. For that it can assign either a $name or a $number to this ACL.

Parameters

string $module: The name of the client module.

string $name: An arbitrary name for this ACL, freely defined by the client module.

int $figure: An arbitrary number for this ACL, freely defined by the client module.

Return value

int The ID of the newly created ACL.

3 calls to acl_create_acl()
AclTest::testNodeAclAddRemoveFromNode in src/Tests/AclTest.php
Includes acl_node_add_acl, acl_node_remove_acl, acl_node_clear_acls
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 34
An API module providing by-user access control lists.

Code

function acl_create_acl($module, $name = NULL, $figure = NULL) {
  $query = \Drupal::database()
    ->insert('acl');
  $query
    ->fields([
    'module' => $module,
    'name' => $name,
    'figure' => $figure,
  ]);
  return $query
    ->execute();
}