You are here

public function Delete::isProtected in User protect 8

Checks if a given operation on an user should be protected.

Parameters

\Drupal\user\UserInterface $user: The user object to check access for.

string $op: The operation that is to be performed on $user.

\Drupal\Core\Session\AccountInterface $account: The account trying to access the entity.

Return value

bool TRUE if the operation should be protected. FALSE if the operation is not protected by this plugin.

Overrides UserProtectionBase::isProtected

File

src/Plugin/UserProtection/Delete.php, line 22

Class

Delete
Protects the user from being deleted.

Namespace

Drupal\userprotect\Plugin\UserProtection

Code

public function isProtected(UserInterface $user, $op, AccountInterface $account) {
  if ($op == 'delete') {
    return TRUE;
  }
  return parent::isProtected($user, $op, $account);
}