You are here

function admin_content_notification_is_current_user_role_allowed_to_send_notification in Admin Content Notification 8

Same name and namespace in other branches
  1. 8.2 admin_content_notification.module \admin_content_notification_is_current_user_role_allowed_to_send_notification()
  2. 7.2 admin_content_notification.module \admin_content_notification_is_current_user_role_allowed_to_send_notification()

Check if current user allowed to send admin content notification.

Return value

bool Return true if allowed to send admin content notification.

2 calls to admin_content_notification_is_current_user_role_allowed_to_send_notification()
admin_content_notification_node_insert in ./admin_content_notification.module
Implements hook_node_insert().
admin_content_notification_node_update in ./admin_content_notification.module
Implements hook_node_update().

File

./admin_content_notification.module, line 49
Module File, consist all related hooks.

Code

function admin_content_notification_is_current_user_role_allowed_to_send_notification() {
  $roles = \Drupal::currentUser()
    ->getRoles();
  $trigger_for_roles = \Drupal::config('admin_content_notification.settings')
    ->get('admin_content_notification_allowed_roles') ?: array();
  return count(array_intersect(array_filter($trigger_for_roles), $roles));
}