You are here

function _social_book_get_permissions in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_book/social_book.install \_social_book_get_permissions()
  2. 8.2 modules/social_features/social_book/social_book.install \_social_book_get_permissions()
  3. 8.3 modules/social_features/social_book/social_book.install \_social_book_get_permissions()
  4. 8.4 modules/social_features/social_book/social_book.install \_social_book_get_permissions()
  5. 8.5 modules/social_features/social_book/social_book.install \_social_book_get_permissions()
  6. 8.6 modules/social_features/social_book/social_book.install \_social_book_get_permissions()
  7. 8.7 modules/social_features/social_book/social_book.install \_social_book_get_permissions()
  8. 8.8 modules/social_features/social_book/social_book.install \_social_book_get_permissions()
  9. 10.3.x modules/social_features/social_book/social_book.install \_social_book_get_permissions()
  10. 10.0.x modules/social_features/social_book/social_book.install \_social_book_get_permissions()
  11. 10.1.x modules/social_features/social_book/social_book.install \_social_book_get_permissions()
  12. 10.2.x modules/social_features/social_book/social_book.install \_social_book_get_permissions()

Build the permissions.

Parameters

string $role: The role.

Return value

array Returns an array containing the permissions.

1 call to _social_book_get_permissions()
_social_book_set_permissions in modules/social_features/social_book/social_book.install
Function to set permissions.

File

modules/social_features/social_book/social_book.install, line 47
Install, update and uninstall functions for the social_book module.

Code

function _social_book_get_permissions($role) {

  // Anonymous.
  $permissions['anonymous'] = [
    'view node.book.field_content_visibility:public content',
  ];

  // Authenticated.
  $permissions['authenticated'] = array_merge($permissions['anonymous'], [
    'view node.book.field_content_visibility:community content',
  ]);

  // Content manager.
  $permissions['contentmanager'] = array_merge($permissions['authenticated'], [
    'create new books',
    'add content to books',
    'create book content',
    'delete any book content',
    'delete own book content',
    'delete book revisions',
    'revert book revisions',
    'edit any book content',
    'edit own book content',
    'view book revisions',
  ]);

  // Site manager.
  $permissions['sitemanager'] = array_merge($permissions['contentmanager'], [
    'administer visibility settings',
  ]);
  if (isset($permissions[$role])) {
    return $permissions[$role];
  }
  return [];
}