You are here

public function CommentAccessTrait::accessEditOwnComment in Comment Permissions 8

Check if user has access to edit own comment.

Parameters

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

$comment_type: Comment entity type.

Return value

bool TRUE user has access to edit own comment, FALSE otherwise.

File

src/CommentAccessTrait.php, line 137

Class

CommentAccessTrait
Class CommentAccessTrait

Namespace

Drupal\comment_perm

Code

public function accessEditOwnComment(AccountInterface $account, $comment_type) {
  if ($account
    ->hasPermission('edit own comments') || $account
    ->hasPermission("edit {$comment_type} own comments")) {
    return TRUE;
  }
  return FALSE;
}