You are here

opigno_calendar_event.install in Opigno calendar event 3.x

Same filename and directory in other branches
  1. 8 opigno_calendar_event.install

Install, update and uninstall functions for the Opigno Calendar Event module.

File

opigno_calendar_event.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the Opigno Calendar Event module.
 */
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;

/**
 * Implements hook_install().
 */
function opigno_calendar_event_install() {
  opigno_calendar_event_set_permissions();
}

/**
 * Sets roles opigno calendar event permissions.
 */
function opigno_calendar_event_set_permissions() {
  $role = Role::load(RoleInterface::AUTHENTICATED_ID);
  $role
    ->grantPermission('create opigno_calendar_event');
  $role
    ->grantPermission('view own opigno calendar event');
  $role
    ->grantPermission('update own opigno calendar event');
  $role
    ->grantPermission('delete own opigno calendar event');
  $role
    ->grantPermission('add members to calendar event');
  $role
    ->save();
  $role = Role::load('content_manager');
  $role
    ->grantPermission('view opigno_calendar_event');
  $role
    ->grantPermission('update opigno_calendar_event');
  $role
    ->grantPermission('delete opigno_calendar_event');
  $role
    ->grantPermission('add any members to calendar event');
  $role
    ->save();
  $role = Role::load('user_manager');
  $role
    ->grantPermission('view opigno_calendar_event');
  $role
    ->grantPermission('update opigno_calendar_event');
  $role
    ->grantPermission('delete opigno_calendar_event');
  $role
    ->grantPermission('add any members to calendar event');
  $role
    ->save();
}

Functions

Namesort descending Description
opigno_calendar_event_install Implements hook_install().
opigno_calendar_event_set_permissions Sets roles opigno calendar event permissions.