You are here

public function UserStatus::mayEditSetting in Fasttoggle 8.2

Access control function.

Parameters

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

Return value

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

Overrides SettingTrait::mayEditSetting

File

src/Plugin/Setting/UserStatus.php, line 59
Fasttoggle User Status

Class

UserStatus
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() {
  $config = \Drupal::config('fasttoggle.settings');
  $sitewide = $config
    ->get('user_core_status');
  $user = \Drupal::currentUser();
  return AccessResult::allowedIfHasPermission($user, "override user blocked option")
    ->andIf(AccessResult::allowedIf($sitewide));
}