# "Regular mode" for admins and moderators (e.g. something like "sudo")

**URL:** https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617
**Category:** Feature
**Created:** [December 9, 2021, 2:35pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617 "2021-12-09T14:35:00Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [December 9, 2021, 2:35pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/1 "2021-12-09T14:35:00Z")

</div>

I’m both an admin _and_ a participant in the Fedora discourse sites. I’d like to be able to separate those roles. I know there’s the “staff color” for Official Posts, but I mean more from _my_ side. Rather than admin wrenches and buttons everywhere whenever I’m logged in, I’d like a menu toggle which would activate Admin Mode on and off.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [December 9, 2021, 3:19pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/2 "2021-12-09T15:19:03Z")

</div>

[https://github.com/discourse/discourse-anonymous-moderators](https://github.com/discourse/discourse-anonymous-moderators)

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [December 9, 2021, 4:53pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/3 "2021-12-09T16:53:56Z")

</div>

We also have

[https://github.com/discourse/discourse-staff-alias](https://github.com/discourse/discourse-staff-alias)

These plugins both let you disguise your identity as a staff member. i.e. you can make a post from a more ‘official’ looking account, which cannot be obviously linked back to you as an individual.

However, I don’t think that’s quite what you’re asking for? You want a way to make Discourse look/feel like it does for regular users, and then “enter sudo mode” to make all the extra admin-only functionality available?

I think it would probably be quite hard to implement… but it would be pretty awesome! Many years ago (before I joined the team), I made this component for my own self-hosted forum. It has the same kind of idea (make regular/admin privileges obvious), but it’s limited to one very specific case:

> [@Warn admins/tl4 when replying to closed topics](https://meta.discourse.org/t/warn-admins-tl4-when-replying-to-closed-topics/83912):
>
> [Admin Warnings Theme Component](https://github.com/davidtaylorhq/discourse-admin-warnings) https://github.com/davidtaylorhq/discourse-admin-warnings When admins click ‘reply’ on a closed topic, they will be warned. This helps to prevent admins accidentally continuing a closed/archived discussion (much to the frustration of other forum users!). Warning text is configurable as a theme setting. To install, follow the instructions here:

If there are other tightly-scoped cases that are often confusing on your site, it might be possible to make similar theme components to popup warnings before taking admin-only actions.

---

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [December 9, 2021, 4:56pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/4 "2021-12-09T16:56:11Z")

</div>

> [@david](#):
>
> However, I don’t think that’s quite what you’re asking for? You want a way to make Discourse look/feel like it does for regular users, and then “enter sudo mode” to make all the extra admin-only functionality available?

Yes, exactly. I guess it partly comes from years of being a sysadmin, and having the idea of “least necessary privilege” drilled into me by practical experience. (`rm -rf` as root in the wrong place on a production system is a rite of passage!)

---

<div class="post-metadata">

### Author: ![Tris20](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tris20/32/264639_2.png) [@Tris20](https://meta.discourse.org/u/Tris20)
#### Post date: [December 10, 2021, 9:17am UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/5 "2021-12-10T09:17:06Z")

</div>

This is also of interest to me. My current workaround is to use both chrome and edge. In chrome I have my admin account, but in edge I am in the admin account and I _impersonate_ a user account with an expired email. The impersonation is only because I don’t want to talk to IT.

In your sittuation you could create a second login, and have one browser for admin, one browser for user. Not perfect but for me it’s been good enough.

---

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [December 13, 2021, 10:41am UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/6 "2021-12-13T10:41:17Z")

</div>

Here’s a good example of where this would be useful:

> [@Attempting to enforce 1 tag per topic in a category](https://meta.discourse.org/t/attempting-to-enforce-1-tag-per-topic-in-a-category/172702/5):
>
> 1 minimal tag from group for a topic not enforced here either despite countless tinkering, recreating group etc… frowning OK my bad, I was testing from an admin account slight_smile Note that the “minimum tag validation” on a category will not happen if: tagging is disabled globally acting user is staff acting user does not have sufficient trust level to use/add tags from [How can I make the "tags" as REQUIRED when create a new Topic - #2 by techAPJ](https://meta.discourse.org/t/how-can-i-make-the-tags-as-required-when-create-a-new-topic/106149/2)

I don’t want to be able to accidentally violate intended tagging rules. (Are non-admin moderators also able to accidentally do this? I can’t easily test, even.)

I could create a separate admin account and demote my main one to a regular user, but I’m afraid I’d miss important flag notifications and messages.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 17, 2022, 9:59pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/7 "2022-01-17T21:59:18Z")

</div>

This is something handled by the browser itself, see

> **[Google is making it easier to swap between user profiles in Chrome](https://www.theverge.com/2021/3/2/22309154/google-chrome-reading-list-new-profile-bookmarks-colors-features)**
>
> It’s rolling out today.

---

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [January 17, 2022, 10:34pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/8 "2022-01-17T22:34:28Z")

</div>

That just looks like it lets me swap entire browser profile? That doesn’t seem like it helps, unless you make an entirely different _Discourse_ user account for admin use.

Or am I missing something. Like, @codinghorror, your account is listed as an admin [here](https://meta.discourse.org/about), so I assume unless you’re doing something I totally misunderstood, you’re running in administrator mode right now. But you’re also acting as a site user. Don’t you run into things where (for example) you accidentally create posts that don’t follow the configured tag rules? (I’ve done that more than once by accident…)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 17, 2022, 10:35pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/9 "2022-01-17T22:35:44Z")

</div>

Not really – part of being an admin is understanding the responsibility you have and the boundaries you must respect. If you can’t do that, you shouldn’t hold admin privileges.

But I also empathize with people who want to be ultra safe and I recommend they use two accounts and log in as a regular user when they need to be _absolutely sure_.. and using the built in browser profile support, this is very easy to do.

---

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [January 17, 2022, 10:43pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/10 "2022-01-17T22:43:30Z")

</div>

Well, it’s kind of like the same thing as running as root on Linux system all the time. It’s not just respecting boundaries, but not accidentally walking over them when you don’t realize they’re there. Some things, like going into the settings aren’t going to happen by accident, but there seem to be a lot of little things where admin bypasses the configuration without any indication that there’s something being bypassed..

As I said above, having a second account isn’t really great, because I’d only see that accounts notifications infrequently.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 17, 2022, 10:44pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/11 "2022-01-17T22:44:28Z")

</div>

I understand the concern, but it isn’t a huge issue in practice, at least not over the 10 years I’ve been working on this project.

(also bear in mind we auto-revoke staff access and require email revalidation for staff that are long absent, which patches most of this automatically IMO)

---

<div class="post-metadata">

### Author: ![leonardo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leonardo/32/228634_2.png) [@leonardo](https://meta.discourse.org/u/leonardo)
#### Post date: [January 18, 2022, 2:55pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/12 "2022-01-18T14:55:37Z")

</div>

hi Matt!  
Just to add some color, the possiblity for an admin user to be acting as a regular user would add an extra dimension to absolutely all admin related authorization logic.

Even though that logic is mostly centralized in [`guardian.rb`](https://github.com/discourse/discourse/blob/main/lib/guardian.rb#L14) and [`/lib/guardian/*.rb`](https://github.com/discourse/discourse/tree/main/lib/guardian), the complexity and bug potential for such a change would be very large, and the necessity of this feature would need need for far outweigh that, which it doesn’t, given the alternatives.

---

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [January 18, 2022, 11:59pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/13 "2022-01-18T23:59:52Z")

</div>

Would it be possible to consider more targeted “protection” for some of the more accidentally-possible things? Like a setting: “Staff must follow category tagging rules”? Honestly that one alone would solve most of the _practical_ problem I am hitting.

Or… find it kind of weird that other things like post-length _are_ still protected for even admins… maybe actually this particular thing is a matter of just making that _the way it works_ rather than adding an option?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 19, 2022, 1:08am UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/14 "2022-01-19T01:08:31Z")

</div>

Adding post length would require the entire database to be changed. There’s a maximum number of characters we can store in the database per field.

---

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [January 19, 2022, 4:03am UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/15 "2022-01-19T04:03:54Z")

</div>

This seems like a non sequitur to me but I might just be missing something. I mean:

- If I am an admin, and I try to post a post that is shorter than `min post length`, I am given the normal error message and can’t proceed.
- If I am an admin, and I try to post with no tags in a category that requires one, it just lets me go ahead.

What’s being stored in the database here?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 19, 2022, 5:17am UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/16 "2022-01-19T05:17:18Z")

</div>

Oh sorry, I meant only post/title length – there’s a maximum size of post length content in the actual database field it is stored in. There’s a similar rule for post title, a maximum number of characters allocated for that particular field in the database.

So if an admin decided, “hey I want a 900,000 character post” or “hey, I want a post with a 500 character title” that’s not possible without changing the database.

It’s really a technicality but since you mentioned post length I was thinking about it.

---

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [January 19, 2022, 10:08am UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/17 "2022-01-19T10:08:21Z")

</div>

Ah OK. Yeah, that’s really he opposite of the problem I’m concerned with 🙂

---

<div class="post-metadata">

### Author: ![Ivan\_Rapekas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivan_rapekas/32/248924_2.png) [@Ivan\_Rapekas](https://meta.discourse.org/u/Ivan_Rapekas)
#### Post date: [January 19, 2022, 2:10pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/18 "2022-01-19T14:10:02Z")

</div>

I assume that OP meant to work most of the time as a regular user. For me, I want to feel myself as a simple user too:

- less buttons
- no access to moder/admin actions
- use simple user cases

After upgrades or tune, I would like to interact with the forum as regular user see it to avoid misunderstands.

For my community admin mode is necessary only for upgrades or tests with plugins and UI. No need to be moderator all the time as well. Also I think that for some kind of people like me temporary switching to admin is better than having two accounts.

The OP wrote about `sudo`. This is almost the same but invert. Usually I temporary switch to anonymous to check some cases. Anyway it would be great to have some light option to activate admin mode like ‘impersonate’ under special regular account.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [January 19, 2022, 3:08pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/19 "2022-01-19T15:08:49Z")

</div>

> [@mattdm](#):
>
> but not accidentally walking over them when you don’t realize they’re there.

It reminds me of something that occurred a few days ago. I’m in the process of migrating a forum.

I granted administrator privileges to the admin of the old forum.  
He’s a Discourse user on two other forums, and also a moderator. So he knows a bit about Discourse interface and navigation.

From his admin account (I didn’t write any guideline to him, I let him discover stuff) he told me he was surprised to see he could access direct messages from other people; He clicked a bit randomly on a public profile page and saw a list of direct messages, which surprised him.

He told me he suddenly thought “Oh well, it seems I’m somewhere where I shouldn’t be” (to be understood as: he shouldn’t be here if he has no administrative/moderation purpose at this time).

He has no idea that he could access these messages from the interface as easily as you access your own direct messages from your profile.

And it also happened to me a few weeks ago also, despite the fact that I’ve been an administrator of two Discourse forums since 2018… 😅

In my opinion, on the “direct message” tab from a user’s public profile, as an admin, there should be an icon or any kind of warning that clicking it is a moderation or administration action, as you’ll see things meant to be “private” (in 99% of users’ minds anyway). 🤷‍♂️

---

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [January 19, 2022, 6:50pm UTC](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617/20 "2022-01-19T18:50:41Z")

</div>

> [@leonardo](#):
>
> Just to add some color, the possiblity for an admin user to be acting as a regular user would add an extra dimension to absolutely all admin related authorization logic.
> 
> Even though that logic is mostly centralized in [`guardian.rb`](https://github.com/discourse/discourse/blob/main/lib/guardian.rb#L14) and [`/lib/guardian/*.rb`](https://github.com/discourse/discourse/tree/main/lib/guardian), the complexity and bug potential for such a change would be very large, and the necessity of this feature would need need for far outweigh that, which it doesn’t, given the alternatives.

So… I’ve been thinking about this, and I’m less convinced that it’s a big change after all. Sure, there’s lots of scattered logic, but doesn’t it all come down to checking `is_admin` or `is_staff`?

The “sudo” would just need to add a “staff\_mode” toggle, and `is_staff` and `is_admin` functions could check the state of that toggle `AND` the `user.admin` or `user.staff` flag. (Of course, activating the toggle would need a special check which _just_ looked at the `user.admin` or `user.staff` value.)

[Next page](https://meta.discourse.org/t/regular-mode-for-admins-and-moderators-e-g-something-like-sudo/211617.md?page=2)
