diff --git a/core/modules/user/src/Form/UserCancelForm.php b/core/modules/user/src/Form/UserCancelForm.php
index c453c76..44ac0e5 100644
--- a/core/modules/user/src/Form/UserCancelForm.php
+++ b/core/modules/user/src/Form/UserCancelForm.php
@@ -108,6 +108,12 @@ public function buildForm(array $form, array &$form_state) {
     // Always provide entity id in the same form key as in the entity edit form.
     $form['uid'] = array('#type' => 'value', '#value' => $this->entity->id());
 
+    // Store the user permissions so that it can be altered in hook_form_alter() if desired.
+    $form['access'] = array(
+      '#type' => 'value',
+      '#value' => $this->currentUser()->hasPermission('administer users'),
+    );
+
     $form = parent::buildForm($form, $form_state);
 
     // @todo Convert to getCancelRoute() after https://drupal.org/node/1987896.
@@ -122,7 +128,7 @@ public function submit(array $form, array &$form_state) {
     // Cancel account immediately, if the current user has administrative
     // privileges, no confirmation mail shall be sent, and the user does not
     // attempt to cancel the own account.
-    if ($this->currentUser()->hasPermission('administer users') && empty($form_state['values']['user_cancel_confirm']) && $this->entity->id() != $this->currentUser()->id()) {
+    if ($form['access']['#value'] && empty($form_state['values']['user_cancel_confirm']) && $this->entity->id() != $this->currentUser()->id()) {
       user_cancel($form_state['values'], $this->entity->id(), $form_state['values']['user_cancel_method']);
 
       $form_state['redirect_route']['route_name'] = 'user.admin_account';
