function acl_add_user in ACL 7
Same name and namespace in other branches
- 8 acl.module \acl_add_user()
- 5 acl.module \acl_add_user()
- 6 acl.module \acl_add_user()
Add the specified UID to an ACL.
1 call to acl_add_user()
- 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 65 
- An API module providing by-user access control lists.
Code
function acl_add_user($acl_id, $uid) {
  $test_uid = db_query("SELECT uid FROM {acl_user} WHERE acl_id = :acl_id AND uid = :uid", array(
    'acl_id' => $acl_id,
    'uid' => $uid,
  ))
    ->fetchField();
  if (!$test_uid) {
    db_insert('acl_user')
      ->fields(array(
      'acl_id' => $acl_id,
      'uid' => $uid,
    ))
      ->execute();
  }
}