You are here

userprotect.install in User protect 8

Same filename and directory in other branches
  1. 5 userprotect.install
  2. 6 userprotect.install
  3. 7 userprotect.install

Install, update and uninstall functions for the userprotect module.

File

userprotect.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the userprotect module.
 */
use Drupal\Core\Session\AccountInterface;

/**
 * Implements hook_install().
 *
 * Installs default userprotect permissions for authenticated users.
 */
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();
}

Functions

Namesort descending Description
userprotect_install Implements hook_install().