Disable, enable and remove accounts
Disable an account when someone leaves or when an account may have been taken over. Remove it only when nothing refers to it any more.
What you'll have at the end
An account that can no longer sign in, an account that works again, or an account that is gone.
Disable an account
./console exp:user:disable jane
./console exp:user:disable jane --applyexp:user:disable does what Edit user settings does in the administration. The account is disabled, and all its
sessions end, the tracked ones under Your devices too. Nothing is removed: content, groups and roles stay. The
audit records access.user.disable.
Enable an account again
./console exp:user:enable jane --applyexp:user:enable refuses an account that was never activated (it still has its activation key). Approve its
registration with exp:user:approve instead, so the registration finishes with its mails
(Approve registrations).
Remove an account
Check what the account did and still owns.
./console exp:user:show jane ./console exp:user:audit janeRun the command without
--apply../console exp:user:delete janeThe command names the account and says whether it is protected.
Attention: User accounts never go to the trash. The account, its settings and its sessions are gone for good. Run the command with
--apply../console exp:user:delete jane --apply
The content the person created stays, with the name of the removed account.
Protected accounts
exp:user:disable and exp:user:delete refuse these accounts, with exit code 1:
| Account | Why |
|---|---|
the anonymous user ([UserSettings] AnonymousUserID) | every visitor is this user |
the user of [UserSettings] UserCreatorID | the kernel creates accounts as this user |
the administrator account (id 14, or the login admin) | the account of a new installation |
the user who acts (--as) | you do not lock yourself out |
| the last enabled administrator | an account with every right must remain |
exp:user:show says whether an account is protected and why. In JSON the key refusal names the reason
(anonymous, creator, admin, self, last_administrator).
Disable or "Deactivate and move"?
The administration has a second way to retire an account: Deactivate and move
(Check user accounts). It is off by default
([UserSettings] DeactivateAndMove). It disables the account and also moves all its locations into a hidden group
without roles, and remembers where they were.
exp:user:disable | Deactivate and move | |
|---|---|---|
| Account can sign in | no | no |
| Sessions end | yes | yes |
| Groups and locations | stay as they are | moved into the group for deactivated accounts |
| Roles from groups | stay assigned | lost while in that group |
| Undo | exp:user:enable | Reactivate and move back in the administration |
The console only disables; it never moves an account. Use Deactivate and move in the administration when an account must also lose the roles of its groups. An account moved there is enabled again only with Reactivate and move back, so that it returns to its groups.
Related pages
- Offboard someone who leaves: the whole procedure.
- Bulk changes: disable many accounts at once.
- Managing members: the same for members in the administration.