This is a followup/spinoff to several issues, including #480660: Add an 'administrator' role to core, #497500: Create an administrator account in the default install profile, separate from user 1, and #570572: Change label for user/1 account from "administrator" to "site maintenance account".

The basic problem is that when you are logged in as user/1, you are very likely to think of yourself as the "site administrator". We might label the user/1 account something else in the installer (as per #570572: Change label for user/1 account from "administrator" to "site maintenance account"), and that's good, but a week later, if they're still using this account, they're not going to remember that, and they'll still be going around the site thinking of themselves as the administrator. The problem, then, is that the "administrator" role that was added to the Drupal 7 install profile does not actually apply to them, but they are likely to think it does.

The possible solution is to make it apply to them as much as possible, and warn them in places where it doesn't. Specifically:

  • @ksenzee at http://drupal.org/node/497500#comment-1738122 suggested this:

    A drupal_set_message on the permissions page would help with the confusion. If you're logged in as user 1 and you remove permissions from a role assigned to user 1, you could get a message letting you know that you're the superuser, so you still have those permissions. We do something similar with themes. If you've set RootCandy as your admin theme, and then you go to admin/build/themes and change your site theme to Garland, you get a message letting you know why the page you're on is still in RootCandy.

  • @sun at http://drupal.org/node/480660#comment-1725182 suggested putting a special note on user/1/edit, in the roles configuration section, explaining that user/1 gets all permissions regardless of what roles are assigned to it.
  • In the same issue, I suggested assigning the "administrator" role to user/1 by default, to remove any confusion surrounding other parts of Drupal that use roles (e.g., block visibility, where assigning a role to user/1 actually does have a real effect, as well as the various other ways that contrib modules might use it).

I think some combination of all of the above things is the right way to solve this problem.

Comments

winston’s picture

Thanks David. I think this would be a good place to consider how all these pieces fit together. The basic issue has been in drupal for a long time. To wit...

"It is not obvious and clear from the UI that permissions simply do not apply to user 1."

I remember when I first started using drupal back in 4.7 that the first few times I went to the permissions screen I was confused about "which of these things will take away my user 1 permissions by accident and lock me out of my site". It didn't take too long to figure this out, but it was definitely an issue.

Adding a default administrator role (while continuing to call the first user admin) exacerbates this issue. It will be natural for the user to think permission changes to this administrator role will apply to the first user they created as well. Where and how do we tell them that this is not so?

There are a number of ways to address this. One is to start with #570572: Change label for user/1 account from "administrator" to "site maintenance account" to indicate to the user right in the installer the special nature of this first user. Another is to look for places in the UI where a "set message" can essentially "smack" the user and remind them of the nature of user/1. Another option David doesn't explicitly reference above is to improve the documentation of the special characteristics of user/1. This could be both in INSTALL.txt as well as in the installation guide in the handbook.

mcrittenden’s picture

I'm not sure that assigning user1 to the administrator role is productive here (which was the third possible solution above), especially since we're telling the user that it basically doesn't matter which roles are assigned to user1 and then we went ahead and assigned a role by default. Comes across like a contradiction.

That being said, I'm not necessarily AGAINST it, per se, I just think it would have to be explained very clearly.

(that was a subscribe in disguise)

winston’s picture

I agree with @mcrittenden. Assigning user/1 to a role implies that that role controls user/1's permissions when we know it won't for drupal 7.

On the other hand, @David_Rothstein brings up the block visibility issue. There is definitely a potential for a wtf moment here for the user where they have assigned block visibility to the new administrator role, but then don't see the block while browsing the site as user/1.

The quandary is that we can avoid the wtf moment regarding block visibility for the user by automatically assigning user/1 to the new admin role, but we create the potential for a very different wtf moment when the user modifies permissions for the administrator role and thinks they will apply to user/1 when in fact they won't. At a practical level, we also have to deal with the fact that the minimal install profile doesn't even create an administrator role to which to assign user/1!

Ideally, I think this issue would be a good place to discuss what mix of modifications to d7 + user interface help text (or set messages) + well defined doc handbook pages would serve to educate the new user to understand the role/permission system while also understanding the special characteristics of user/1 with the fewest possible wtf moments for the new drupal site maintainer.

So here is my initial stab at this...

Suggestion
1. Modify the label in the installer to be "Site maintenance account" as per #570572: Change label for user/1 account from "administrator" to "site maintenance account"
- makes a start at suggesting the special nature of user/1 especially in regards to upgrade process and best practice
- allows us to avoid a lot of verbiage trying to explain our way around how the "administrator" account created during install is not controlled by the administrators role and in fact is entirely unrelated.

2. Create a well defined handbook page that describes the role and permission system, the concept of an administrator role, and highlights the special nature of user/1 (site maintenance account). This page would be an excellent place to describe some best practices around user/1 for different types of sites where the issue of block visibility by role can be mentioned.

3. Add help text to direct users to this handbook page from "admin/config/people/roles", and "admin/config/people/permissions", and possibly from "admin/config/people/accounts" (under the Administrator Role assignment fieldset).

4. Add some text to the INSTALL.txt (and possibly UPGRADE.txt) which very succinctly describes the role system and special handling of the site maintenance account (user/1) and also points the user to the well defined handbook page on this topic described above.

Justifications:
1. Why not assign user/1 to the administrative role automatically?
- It implies to the new user that modifications to the administrative role will affect user/1 when in fact they won't. I think that creates a much greater wtf moment for the user than the block visibility issue.
- The administrative role is not created using the minimal install profile so it would also be complicated to implement perhaps...

2. Why not use set message on the permissions screen to tell the user that their changes don't apply to user/1 when they make changes to permissions for a role to which user/1 is assigned?
- To me this gives the impression to the user that "something is wrong".
- I think it is overkill if we have documented this behavior elsewhere
- I think it is reasonable for us to expect that a user with a more than trivial site will read the docs on roles and permissions if we point them to it from critical points in the UI.

3. Why not create a second account during install to assign to the administrator role separate from user/1 (as per #497500: Create an administrator account in the default install profile, separate from user 1)?
- This would be a major hassle for many users especially for users who are creating simple blog sites, etc. The need for them to have to have multiple email addresses to supply at install time is too much.

Conclusion
I think my suggestion still leaves open the potential wtf moment for the user when they assign a block to be only visible to the administrator role and find that user/1 doesn't see it. However, how this would affect users will depend a lot on the site. For example if someone truly uses the site maintenance account (user/1) just for upgrading and installing modules, then this won't really be an issue for them. If the user decides that they have a very simple site and would rather just use user/1 as a regular account then our handbook page should recommend that they assign the site maintenance account to the administrator role. In other words, this will be a site dependent issue that should be well documented rather than "hard coded" into the UI.

David_Rothstein’s picture

Status: Active » Needs work
StatusFileSize
new5.15 KB

It sounds like we're in agreement that there should be some kind of text in the UI (and I agree that help text is better than a drupal_set_message).

I don't think we have a handbook page to link to now, so let's start with some text that is intended to stand on its own.

In the attached patch, I also added some code to assign the administrator role to user/1, as I originally suggested. It was actually pretty easy to write, so let's try it for now and see how it works. (In my opinion, the combination of putting help text in the correct places as well as assigning this role should eliminate any possible confusion.)

The attached patch is still "needs work" because I didn't get all the places @winston mentions above, just a couple places. I also think the wording of the text probably needs some improvement.

Another thing we can discuss: Currently on admin/config/people/permissions, I made the new help text only show up if the current user is logged in as user/1. It seemed less relevant to me for other users (at least the way I initially tried to phrase it), but we can figure out if that's true or not.

winston’s picture

StatusFileSize
new54.16 KB
new83.37 KB

@David_Rothstein, so I took a look where this hits in the UI. Also, I'm attaching two screenshots with the red box highlighting the change your patch makes. It should be noted that at the moment the patch adds the highlighted text in both cases ONLY if the currently logged on user is user/1.

I'm not yet convinced about adding user/1 to the administrator role automatically. There is nothing stopping the user from adding user/1 to the administrator role if they decide to use user/1 as a day to day admin account as well.

Also, I would ask to consider why was the administrator role added to core (at least in the default install profile) in the first place? My understanding was that this was to encourage the use of day-to-day admin users separate from user/1. Providing an administrator role that automatically receives all new permissions makes it much more attractive for the user to NOT use user/1 as a day to day admin. By now assigning user/1 to the administrator role we water down that message.

I'm making the "anti" case for assigning user/1 to the administrator role automatically. That said, I don't think it would be a disaster to do it. Either way we'll need solid docs (and maybe help text) to further explain what is going on with user/1.

uNeedStuff’s picture

I think the whole user/1 and assigning it to the administrator role is confusing, and roles should be blocked from being assigned, stating that user/1 is a special user, and has access to everything. If you want to apply a role, add a user. Either it's special or it isn't. Every exception you make brings in more confusion.

David_Rothstein’s picture

I think you might be overthinking this a bit...

In Drupal 7, user 1 is special in exactly one way: It bypasses all permission checks.

Roles and permissions, however, are two totally different systems. Roles are simply about classifying users - that's it. In Drupal core alone, there is one place besides the permission system that uses roles - as mentioned above, that's block visibility. In contrib modules, there might be dozens more. So we certainly don't want to prevent roles from being assigned to user 1.

The question is what is the intelligent default we should be providing new sites in the default install profile. I would think that if you asked people to classify users on their site and one possible category was "administrators", just about every Drupal site owner in the world would put user/1 in that category. So the idea is simply to make the default settings match what they would reasonably want.

uNeedStuff’s picture

@ David_Rothstein, can uers1 be blocked from something? I guess I'm not clear on that. If you assign a role to user1 and block that role from something is user1 blocked from it?

From what I've understood about user1:
They have access to everything.
From a best practice perspective, this user should only be used for maintenance.
That this is a special user.

If you want to make it understandable that the role assigned isn't the same as the permission given to this user automatically, then you need to keep them separate.

If you assign the role administrator to this user the assumption is that anyone with that role is going to have the same abilities, and that just isn't true. It's a simple If Then. If I'm an Administrator, and I give someone else that same Role Then they will have the same access. This however doesn't return a true statement.

David_Rothstein’s picture

@ David_Rothstein, can uers1 be blocked from something? I guess I'm not clear on that. If you assign a role to user1 and block that role from something is user1 blocked from it?

Depends what you mean by "blocked". The only place I specifically know of where user 1 is treated specially is for permissions. There are probably some contrib modules that have code treat user 1 specially in different contexts, but they probably shouldn't.

I'm definitely not saying user 1 isn't a special case; it is (in the permissions system). But, the patch above already has provisions to explain what happens on the permission page, so if that works well, then it shouldn't be a problem to also assign user 1 a role.

uNeedStuff’s picture

The whole point I'm trying to make with my suggestions is that the user1 is now called a "Site Maintenance" account. Either roles apply to it or they don't. I believe what is happening is causing more confusion for the new user then less. Either the account should be used special case or it shouldn't. Each exception just leads to more confusion for the new user. Which I thought was the whole point of making these changes. Either the idea that there is a user that is used for maintenance and not for something else is valid and what the POV is going to be from a Drupal standpoint or you might as well leave it as it is, and not have it renamed.

You understand that Roles and Permissions are two totally different systems, does the person just starting? Or do they believe that the role they assign to a user gives them permissions?

imho most new users are going to be assigning permissions based on a role, and thinking from that perspective.

What I was trying to understand was if I assign a role of Administrator, and then block visibility to that role for a page, would User1 still be able to access that page? I don't fully understand how permissions and roles are different other then individual permission grants, and my basic understanding of what user1 is. I thought nothing effected the abilities of user1.

David_Rothstein’s picture

Note that there is an independent patch at #704354: Add user 1 to the administrator role in standard.profile. which would give the administrator role to user 1 (but does not do any of the other things discussed here - it is just focused on the role).

David_Rothstein’s picture

Here's a forum post showing an example of how this can be confusing (from http://drupal.org/node/1040812):

Another problem (or possible bug?): How to turn off the contextual links for the ADMIN [user #1]? Is it always turned on by default for admin users? In permission, when I turn off the contextual links for the "Administrator", it doesn't work. It is always on for the Admin. I would like to be able to turn it off for Admins too.

I think this helps show why we need some help text in the UI explaining that user 1 automatically gets all permissions.

hansfn’s picture

And my "bug" report - #1072226: "Use the administration toolbar" permission have no effect for the Administrator role - also shows that people still get confused. (Thx, David, for pointing me to this thread.)

To me the most important fix is to display a message on the permissions page so I understand/remember that the administrator permissions don't affect user 1.

David_Rothstein’s picture

Version: 7.x-dev » 8.x-dev

Another example of this being confusing: #1239654: Overlay ignores admin permissions

misterT’s picture

I opened the issue (#1239654: Overlay ignores admin permissions) listed above (http://drupal.org/comment/reply/572240/4865900#comment-4865900), and I want to point out that there is nothing in the user interface to indicate that user 1 has any kind of special permissions. Editing the user profile has the exact same options as any other user, and it stands to reason that applicable role permissions would take effect. I think user 1, or any user that is *not* affected by the permissions (accessed from people->permissions in Drupal 7), should *not* have role settings available to it.

yoroy’s picture

So would it be a more global (better?) fix to have a consistent indicator shown that you are logged in as user/1?

misterT’s picture

So would it be a more global (better?) fix to have a consistent indicator shown that you are logged in as user/1?

I think so. Specifically a consistent indicator that you are logged in as a user that is not subject to permissions. Perhaps a "super user" status? IIRC you can set the permissions for this user but they don't apply (all permissions are always granted regardless) and there is nothing in this process to let the user know about the discrepancy.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

aaronmchale’s picture

Status: Needs work » Closed (outdated)

Marking as outdated, because: no activity in years and this may no longer be needed once #540008: Add a container parameter that can remove the special behavior of UID#1 is committed.