public static function BookAccess::getAuthorGrants in Book access 6.2
Same name and namespace in other branches
- 7.2 book_access.module \BookAccess::getAuthorGrants()
Returns the book author grants.
Parameters
$bid: The book ID.
$uid: The user ID for the book author.
$defaults: An array containing the default values for the grants.
Return value
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::getAuthorGrants()
- book_access_ui_grants_form in ./
book_access_ui.admin.inc - Form builder for the book access configuration page.
File
- ./
book_access.module, line 257 - Allows to set the access control for book nodes on a per book basis. It is based on forum_access.module and tac_lite.module.
Class
- BookAccess
- @file
Code
public static function getAuthorGrants($bid, $uid, array $defaults = array()) {
$grants = db_fetch_array(db_query_range('SELECT * FROM {book_access_author} WHERE nid = %d AND uid = %d', $bid, $uid, 0, 1));
if (!$grants) {
$defaults = array_filter($defaults);
foreach (self::grantIDs() as $id) {
$grants[$id] = !empty($defaults[$id]);
}
}
return $grants;
}