You are here

public static function BookAccess::setAuthorGrants in Book access 7.2

Same name and namespace in other branches
  1. 6.2 book_access.module \BookAccess::setAuthorGrants()

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'.

4 calls to BookAccess::setAuthorGrants()
BookAccess::resetToDefault in ./book_access.module
Resets book permissions to its defaults, ignoring user-specific ones.
book_access_node_insert in ./book_access.module
Implements hook_node_insert().
book_access_node_update in ./book_access.module
Implements hook_node_update().
book_access_ui_grants_form_submit in ./book_access_ui.admin.inc
Form submission callback for book_access_ui_grants_form().

File

./book_access.module, line 641
Allows to set the access control for book nodes on a per book basis. Based on forum_access.module and tac_lite.module.

Class

BookAccess
@file

Code

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