You are here

function _bear_setup_users_and_roles in Bear 8

Setup default users and roles.

1 call to _bear_setup_users_and_roles()
bear_install in ./bear.install
Implements hook_install().

File

./bear.install, line 44
Install, update and uninstall functions for the bear installation profile.

Code

function _bear_setup_users_and_roles() {

  // Allow visitor account creation with administrative approval.
  $user_settings = \Drupal::configFactory()
    ->getEditable('user.settings');
  $user_settings
    ->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)
    ->save(TRUE);

  // Enable default permissions for system roles.
  user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array(
    'use text format basic_html',
  ));
  user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, array(
    'use text format basic_html',
  ));

  // Assign user 1 the "administrator" role.
  $user = User::load(1);
  $user->roles[] = 'administrator';
  $user
    ->save();
  _bear_setup_role_editor();
}