Remove hardcoded anonymous and authenticated user roles

Created on 21 May 2009, almost 16 years ago
Updated 7 April 2025, 15 days ago

For a long time I've been wondering if this was possible, and eventually I decided to try writing a patch for it :)

The attached patch removes Drupal's hardcoded anonymous and authenticated user roles and replaces them with a simple system where any role on a site can be auto-assigned to users (a) before they log in, and (b) right after they have registered for an account.

The patch is basically functional and has the following advantages:

  1. The "anonymous user" and "authenticated user" roles that Drupal currently has are weird and confusing. Why? Because "anonymous" and "authenticated" represent states of interaction with a computer, but most other roles represent categories of people (think "Editor", "Administrator", etc). Things would be much clearer if the roles that users are automatically assigned work the same way as other roles on the site. For example, in this initial patch the default install profile starts off with anonymous users being assigned to a "Guest" role and newly-registered users being granted a "Member" role, but the expert profile doesn't start with any roles at all, and sites are free to use whatever roles are meaningful to them.
  2. The patch makes it possible to auto-assign the same role for both (a) and (b) above, if you want unauthenticated and authenticated users on your site to share the same base set of permissions. (No more clicking two checkboxes in a row on the permissions page!)
  3. Some sites have no need for "authenticated users" at all (for example, single user blogs). Currently, Drupal forces that role on them, but this patch means it won't anymore.
  4. If your site registration policies get more strict (for example, if you previously allowed open registration but then later switched to requiring email verification), this patch allows you to easily separate your users into "before" and "after" by switching the role that is auto-assigned to newly registered users. For example, you could create a new role called "Verified Member" and auto-assign that; you can then safely grant this new role more permissions knowing that anyone who gets it must have gone through more verification steps during registration than users who got the older "Member" role.
  5. Any patch which involves deleting as much ugly, special-case code as this one does can't be a bad thing :)

Screenshots are attached as well. I think this patch actually makes sense, but it's a big change so someone please tell me where I went wrong with it :)

✨ Feature request
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

user system

Created by

πŸ‡ΊπŸ‡ΈUnited States David_Rothstein

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for sharing your idea for improving Drupal.

    We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

  • πŸ‡¬πŸ‡§United Kingdom catch

    I think the overall issue is still relevant, it's just obviously not been a priority for anyone to work on for a long time.

Production build 0.71.5 2024