You are here

public function BookAccessHelper::defaultGrants in Book access 1.x

Returns the default access permissions.

Parameters

string $grant_type: The type of grant to get defaults for.

Return value

array An array of grants.

1 call to BookAccessHelper::defaultGrants()
BookAccessHelper::setDefaultForRole in src/BookAccessHelper.php
Set defaults for newly created roles.

File

src/BookAccessHelper.php, line 68

Class

BookAccessHelper
Helper functions for book_access.

Namespace

Drupal\book_access

Code

public function defaultGrants(string $grant_type) {
  switch ($grant_type) {
    case '__author__':
      return [
        'grant_view' => TRUE,
        'grant_update' => TRUE,
        'grant_delete' => TRUE,
        'grant_admin_access' => FALSE,
        'grant_add_child' => TRUE,
        'grant_edit_outline' => TRUE,
      ];
    case 'administrator':
      return [
        'grant_view' => TRUE,
        'grant_update' => TRUE,
        'grant_delete' => TRUE,
        'grant_admin_access' => TRUE,
        'grant_add_child' => TRUE,
        'grant_edit_outline' => TRUE,
      ];
    default:
      return [
        'grant_view' => TRUE,
        'grant_update' => FALSE,
        'grant_delete' => FALSE,
        'grant_admin_access' => FALSE,
        'grant_add_child' => FALSE,
        'grant_edit_outline' => FALSE,
      ];
  }
}