You are here

public function AccessCheck::isTermAllowedByUserRole in Permissions by Term 8.2

Same name and namespace in other branches
  1. 8 src/Service/AccessCheck.php \Drupal\permissions_by_term\Service\AccessCheck::isTermAllowedByUserRole()

Parameters

int $tid:

string $sUserRole:

string $langcode:

Return value

bool

1 call to AccessCheck::isTermAllowedByUserRole()
AccessCheck::isAccessAllowedByDatabase in src/Service/AccessCheck.php

File

src/Service/AccessCheck.php, line 182

Class

AccessCheck
AccessCheckService class.

Namespace

Drupal\permissions_by_term\Service

Code

public function isTermAllowedByUserRole($tid, $sUserRole, $langcode) {
  $query_result = $this->database
    ->query("SELECT rid FROM {permissions_by_term_role} WHERE tid = :tid AND rid IN (:user_roles) AND langcode = :langcode", [
    ':tid' => $tid,
    ':user_roles' => $sUserRole,
    ':langcode' => $langcode,
  ])
    ->fetchField();
  if (!empty($query_result)) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}