You are here

function userprotect_install in User protect 8

Same name and namespace in other branches
  1. 5 userprotect.install \userprotect_install()
  2. 6 userprotect.install \userprotect_install()
  3. 7 userprotect.install \userprotect_install()

Implements hook_install().

Installs default userprotect permissions for authenticated users.

File

./userprotect.install, line 15
Install, update and uninstall functions for the userprotect module.

Code

function userprotect_install() {
  $role = \Drupal::entityTypeManager()
    ->getStorage('user_role')
    ->load(AccountInterface::AUTHENTICATED_ROLE);
  $role
    ->grantPermission('userprotect.mail.edit');
  $role
    ->grantPermission('userprotect.pass.edit');
  $role
    ->grantPermission('userprotect.account.edit');
  $role
    ->save();
}