You are here

public function CommentStatus::mayEditSetting in Fasttoggle 8.2

Access control function.

Parameters

$comment: The comment against which to check (un)publish permission.

Return value

boolean Whether the user is allowed to (un)publish the comment.

Overrides SettingTrait::mayEditSetting

File

src/Plugin/Setting/CommentStatus.php, line 59
Fasttoggle Comment Status

Class

CommentStatus
Abstract interface for settings. Plugin strings are used for quick filtering without the need to instantiate the class.

Namespace

Drupal\fasttoggle\Plugin\Setting

Code

public function mayEditSetting() {
  $user = \Drupal::currentUser();
  return AccessResult::allowedIfHasPermission($user, "override comment published option")
    ->orIf(AccessResult::allowedIfHasPermission($user, 'moderate comments'));
}