You are here

public function CommentAccessTrait::accessSkipCommentApproval in Comment Permissions 8

Check if user has access to skip comment approval.

Parameters

\Drupal\Core\Session\AccountInterface $account: User account proxy.

$comment_type: Comment entity type.

Return value

bool TRUE user has access to skip comment approval, FALSE otherwise.

2 calls to CommentAccessTrait::accessSkipCommentApproval()
Comment::preSave in src/Entity/Comment.php
Acts on an entity before the presave hook is invoked.
CommentForm::form in src/CommentForm.php
Gets the actual form array to be built.

File

src/CommentAccessTrait.php, line 118

Class

CommentAccessTrait
Class CommentAccessTrait

Namespace

Drupal\comment_perm

Code

public function accessSkipCommentApproval(AccountInterface $account, $comment_type) {
  if ($account
    ->hasPermission('skip comment approval') || $account
    ->hasPermission("skip {$comment_type} comment approval")) {
    return TRUE;
  }
  return FALSE;
}