public static function BookAccess::setUserGrants in Book access 1.x
Sets the user grants for book pages.
The method delete the user grants before to set the new ones.
Parameters
$bid: The book ID.
$uids: An array of user IDs for which to add the book grants.
$grants: An array of grants, in the format
$grants[$grant][$uid];
, where
$grant;
is a string between 'grant_view', 'grant_update', 'grant_delete', 'grant_admin_access', 'grant_add_child', 'grant_edit_outline', and
$uid;
is the user ID.
File
- src/
Access/ BookAccess.php, line 658 - Allows to set the access control for book nodes on a per book basis.
Class
- BookAccess
- @file
Namespace
Drupal\book_access\AccessCode
public static function setUserGrants($bid, array $uids, array $grants) {
db_delete('book_access_user')
->condition('nid', $bid)
->execute();
self::addUserGrants($bid, $uids, $grants);
}