You are here

public function NodeComments::mayEditSetting in Fasttoggle 8.2

Access control function.

Parameters

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

Return value

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

Overrides SettingTrait::mayEditSetting

File

src/Plugin/Setting/NodeComments.php, line 61
Fasttoggle Node Promoted

Class

NodeComments
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 {$this->object->getType()} comment option")
    ->orIf(AccessResult::allowedIfHasPermission($user, 'administer comments'));
}