You are here

protected function CommentSelection::userHasAdminPerm in Comment Permissions 8

Determine if current use has admin role for at least one comment type.

Return value

bool TRUE user has administration role, FALSE otherwise.

2 calls to CommentSelection::userHasAdminPerm()
CommentSelection::buildEntityQuery in src/Plugin/EntityReferenceSelection/CommentSelection.php
Builds an EntityQuery to get referenceable entities.
CommentSelection::validateReferenceableNewEntities in src/Plugin/EntityReferenceSelection/CommentSelection.php
Validates which newly created entities can be referenced.

File

src/Plugin/EntityReferenceSelection/CommentSelection.php, line 65

Class

CommentSelection
Overrides CommentSelection plugin.

Namespace

Drupal\comment_perm\Plugin\EntityReferenceSelection

Code

protected function userHasAdminPerm() {
  $is_admin = FALSE;
  foreach ($this
    ->getConfiguration()['target_bundles'] as $comment_type) {
    if ($this
      ->accessAdministerComment($this->currentUser, $comment_type)) {
      $is_admin = TRUE;
    }
  }
  return $is_admin;
}