3 namespace Drupal\user\Plugin\Action;
5 use Drupal\Core\Action\ActionBase;
6 use Drupal\Core\Session\AccountInterface;
12 * id = "user_unblock_user_action",
13 * label = @Translation("Unblock the selected users"),
17 class UnblockUser extends ActionBase {
22 public function execute($account = NULL) {
23 // Skip unblocking user if they are already unblocked.
24 if ($account !== FALSE && $account->isBlocked()) {
33 public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
34 /** @var \Drupal\user\UserInterface $object */
35 $access = $object->status->access('edit', $account, TRUE)
36 ->andIf($object->access('update', $account, TRUE));
38 return $return_as_object ? $access : $access->isAllowed();