You are here

function _social_user_get_permissions in Open Social 10.1.x

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

Return the permissions per role.

Parameters

string $role: The role to get the permissions for.

Return value

array A list of permissions.

2 calls to _social_user_get_permissions()
social_user_update_8003 in modules/social_features/social_user/social_user.install
Add permissions to view and block users for site manager role.
_social_user_set_permissions in modules/social_features/social_user/social_user.install
Function to set permissions.

File

modules/social_features/social_user/social_user.install, line 155
Install, update and uninstall functions for the social_user module.

Code

function _social_user_get_permissions($role) {

  // Anonymous.
  $permissions['anonymous'] = [];

  // Authenticated.
  $permissions['authenticated'] = array_merge($permissions['anonymous'], [
    'access user profiles',
    'cancel account',
    'change own username',
    'select account cancellation method',
  ]);

  // Content manager.
  $permissions['contentmanager'] = array_merge($permissions['authenticated'], []);

  // Site manager.
  $permissions['sitemanager'] = array_merge($permissions['contentmanager'], [
    'view users',
    'block users',
    'administer navigation settings',
    'administer social_user settings',
    'assign contentmanager role',
    'assign sitemanager role',
    'view blocked user',
  ]);
  if (isset($permissions[$role])) {
    return $permissions[$role];
  }
  return [];
}