Simple role toggler¶
Lets users switch off some of the roles they hold while they browse, and switch them back on when they need them.
An example¶
Claire edits the site's news and also administers it. She holds three roles: Toggler, Editor and Administrator. To check a page the way a regular reader sees it, she clears Editor and Administrator in the role form and presses Apply.
The page reloads without the administration toolbar, the contextual links and everything the two roles allowed. Her account is unchanged. Only her requests run without those roles. When she needs to edit again, she ticks them back on, or presses All roles.
She can also press Anonymous to see the site as a visitor who is not logged in, for the rest of her session.
What it is for¶
- Previewing. Content editors and site builders see the site as the people they build it for.
- Working with fewer rights. An administrator browses with an everyday account's permissions and switches the powerful role on only when needed.
- Testing access. A site builder checks what a role can and cannot reach without creating test accounts.
The roles are never changed in the database, so nobody locks themselves out: the form to switch them back on always stays available.
Requirements¶
- Drupal 11.2 or newer, including Drupal 12
- No other module
Where to go next¶
- Configuration: the permissions, restricted roles, the blocks and the settings.
- How it behaves: what the user sees, how long a choice lasts, and what happens at login and logout.
- Roles in one tab: different roles in different browser tabs.
- Architecture: how the module swaps the account, for developers.
- Codebase metrics: a measured snapshot of the code.
The module grew from Role toggle and its 8.x-2.x rewrite by Axel Rutz (geek-merlin).