You are here

public static function BookAccess::setAuthorGrants in Book access 1.x

Sets the author grants for book pages.

The method delete the author grants before to set the new ones.

Parameters

$bid: The book ID.

$uid: The user ID of the book author.

$grants: An array of grants, in the format

$grants[$grant];

, where

$grant;

is a string between 'grant_view', 'grant_update', 'grant_delete', 'grant_admin_access', 'grant_add_child', 'grant_edit_outline'.

1 call to BookAccess::setAuthorGrants()
BookAccess::resetToDefault in src/Access/BookAccess.php
Resets book permissions to its defaults, ignoring user-specific ones.

File

src/Access/BookAccess.php, line 614
Allows to set the access control for book nodes on a per book basis.

Class

BookAccess
@file

Namespace

Drupal\book_access\Access

Code

public static function setAuthorGrants($bid, $uid, array $grants) {
  db_delete('book_access_author')
    ->condition('nid', $bid)
    ->execute();
  self::addAuthorGrants($bid, $uid, $grants);
}