With the addition of an administrator role to core in #480660: Add an 'administrator' role to core, I think we want to encourage people to actually use it (and to leave user 1 as a 'root' account that they use only for emergencies). However, they are unlikely to ever do that since we log them in as user 1 right at the beginning.

A possible solution to this problem would be to have the default install profile create two users, assign the admin role to user #2, and log them in as that. They would still get credentials for user 1 (to use when they need "real" root access), but by starting them off with a second account, we'd set things up for them in a way so that they would rarely need to do that.

That would likely be a tricky patch - due to Drupal enforcing unique email addresses per user account, among other things. I do not think this is something I'd personally be able to work on any time soon, but I'm starting this issue to get the ball rolling.

Fundamentally, this is a usability issue, because we have now introduced this "Administrator" role all over core, so someone administering the site as user 1 would reasonably assume that when they see that, it's talking about them... but it's not :) This may cause confusion on the permissions page (if I remove certain permissions from administrators, won't I be a bit confused when I myself still have those permissions?), the blocks administration pages (if I make a block that is only supposed to show for site admins, won't I be confused if I, as user 1, cannot see it?), and perhaps other places.

To remove this confusion, I suggest we essentially bypass it, by making it so that people do not ever really get encouraged to log in as user 1 at all.

CommentFileSizeAuthor
#32 Capture.JPG23.34 KBravimane23

Comments

Bojhan’s picture

No, I don't see how this is in anyway more user friendly? It's basically a work around because we don't want to assign user 1 to role administrator?

David_Rothstein’s picture

Assigning the administrator role to user 1 won't help with the permissions page, since user 1 always has permission to do everything. @sun's argument at the other issue (http://drupal.org/node/480660#comment-1724218) was that because of this, assigning the role to user 1 might actually confuse people even more than not assigning it.

Bojhan’s picture

I don't think it does, since assigning the role to user 1 makes them able to do things. If we introduce something that prevents them from doing things, and instead require them to learn - we are in the wrong direction.

ksenzee’s picture

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.

michaelfavia’s picture

Why not ditch the special casing for user 1 instead? It is an arbitrary holdover that shouldnt be necessary anyway with a "Administrative User" role. Just prevent the deletion of the last administrative user to make sure you don't lose administrative capability of the site. Then assign user 1 to the admin role like you would for any other admin and all admins are equal.

michaelfavia’s picture

Ok so i see 2 real options here for improvement and I'm willing to help implement any of them. I think that the "special user 1" constraint goes against everything we are trying to tell our users about how permissions come from roles not users so I'd prefer to ditch the special casing of user 1. THis also happens to solve the main concern of this issue. Here are the options as i see them:

1. Administrative user role is provided by default on install. It is hardcoded to pass all user_access() checks just like user 1 was and the checkboxes in permissions are disabled. The name can be changed but it cannot be deleted.

2. Administrative user role is provided by default on install. Its permissions, set by the permissions page are respected like normal roles excepting the "administer permissions" one which is disabled. New permissions are automatically enabled as they are now. The name can be changed but it cannot be deleted.

senpai’s picture

I'm coming to this issue from #46149: Prevent account cancellation for uid 1 (at comment #111) Seems to me that the issue I'm currently reading here is trying to stop the automatic logging-in of new site owners as uid1 and instead log them into a user with decent admin perms, but not the root user account. This is a lofty, difficult, yet worthwhile goal.

Let me share my thoughts about Michaelfavia's suggestion in #5 and #6 where he says:

Why not ditch the special casing for user 1 instead? It is an arbitrary holdover that shouldnt be necessary anyway with a "Administrative User" role. Just prevent the deletion of the last administrative user to make sure you don't lose administrative capability of the site.

Michael, an 'administrative' user is not necessarily god-of-the-site. Sure, it *could* be that way, especially in single user blog sites, but as soon as you start making 12 to fifteen roles for your site, and placing Site Administrators (the 'administrator' role on more sites that you can count) in charge of "everything but the stuff they shouldn't be touching", things will fall apart. For the sake of argument, "everything but the stuff they shouldn't be touching" excludes user permissions and the php filter. Those things were preset by the site's developers using the root user account (uid1) during construction of the site, and handing those settings over to the administrator role would give 14 people who know nothing about user permissions the ability to wreck the site.

Sure, you *could* claim that the 'administrator' role was never designed for such a purpose, but consider this. There's more than one site out there that is currently using the 'administrator' role for the exact purpose outlined above, and if you try to make this role into a root user or superuser role, you'll have a lot of peeved people come upgrade time.

I'm -1 on removing uid1's special casing. It's there for a reason, it's the only way to ensure that the owner of the site doesn't get locked out of their own site by fiddling with the site's settings. Let's pursue the idea set forth at the top of this issue and see where that takes us.

David_Rothstein’s picture

Related issue at #570572: Change label for user/1 account from "administrator" to "site maintenance account" (sort of a first step towards the ideas discussed here, but one that can still happen for Drupal 7... for this issue, we're probably looking more at Drupal 8 at this point).

mcrittenden’s picture

-1 for me. I'm not sure how creating two separate users could possibly be helpful. For the developer, it's more of a nuisance than anything, and for the DIY blogger, it's just another layer of confusion.

alexanderpas’s picture

-1 From the developer, as it creates another nuisance.

-1 From the DIY blogger, as it adds another layer of confusion.

-1 as it requires two seperate email addresses, creating both nuisance and confusion.

also, i like to have a root user (keeping the special casing of user/1) on my system, since i can use it when stuff goes wrongTM.

David_Rothstein’s picture

The only way we'd implement this is if we could do it without requiring two separate email addresses, which as mentioned above is one of the reasons why this is difficult. We'd also start both accounts off with the same password - so if done correctly, the user wouldn't even think of them as two separate accounts.

This pattern is certainly very common in operating systems and is very useful and user-friendly there... plus, because of the way Drupal is built, the typical user would need to log in as the "root" account much less frequently than they do in an operating system. A typical blog site might never need to use this account at all, ever.

But anyway, this is all just speculation for now - we can think about it for Drupal 8, I suppose :)

David_Rothstein’s picture

By the way, @ksenzee's suggestion in #4 (now recycled and migrated several times over) is now living at #572240: Explain in the user interface that user/1 and the "administrator" role are not the same thing ....

uNeedStuff’s picture

Thinking from the stand point of the DIY Blogger, is there a way you could include in the installation a request for a User Name (Name you want your content to show as posted by). With the text explaining a bit about the Site Maintenance Account (user 1), and that the User Name account will be an Administrator with the Administration role, and the name under which all content would be added when logged in as this user. That this account becomes their user account, and can be used to do anything they grant to the Administration role. That the purpose of the Site Maintenance account is to be used solely for advanced site building and configuration, as well as maintaining the site. Possibly the option might want to be added that they would be asked if they want to logout of the Site Maintence account, and login as this user to begin adding content.

I agree that this account would have to allow for a duplicate email address (some people only have one), and would be automatically created based on the answers provided, including a request for a password for this account.

Personally I feel that without adding more information or outlining steps to get an "administrator" user, the whole Site Maintenance account is going to confuse people as much as referring to it as user/1.

alexanderpas’s picture

@WebWeaver64
you are confusing me, could you clarify yourself?

@David Rothstein
I don't think we can/want to create sudo (yet) in drupal ;)

alexanderpas’s picture

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

also, this will not be in D7, we've entered code slush already.

uNeedStuff’s picture

In the current D7 installation on the Configure site screen, you're asked to provide a User Name/email/password for the Site Maintenance account (I'm going to skip over my issues with this whole things).

What I'm suggesting would be:

Site Maintenance Account:
The Site Maintenance account is to be used solely for advanced site building and configuration, as well as maintaining the site. This account is granted permissions automatically.
User Name:
Email:
Password

Administrator Account:
The Administrator account is to be used for your daily administration, and entering content. This user is granted all permissions given to the Administrator role. This account is granted permissions based on their role as an Administrator
User Name:
Email:
Password

Once installation is completed they would be presented with a page that said:
Continue creating your site (you will be signed in with the Site Maintenance account)
Start adding content (you will be signed in with your Administrator account)

This right here lets them know with no confusion that they have two different users, and that they have different uses and permission, and that one user (user2) has permissions based on the Role Administrator, and that those permissions only apply to user 2. That the suggestion here is to use User2, for creating content, and User1 is for "building" the site. As it isn't saying anything about a role for User1, it suggests that it doesn't have one, which it doesn't need.

alexanderpas’s picture

I think this can only happen when it is done trough the install profile.
while i can (partially) agree with the ability to (optionally) create this (secondary) account in the default install profile, i certainly DO NOT WANT this to happen in the expert profile (or a single-user blog for example.)

uNeedStuff’s picture

Maybe I'm missing the point of all this user1 stuff. I thought the whole idea behind it was to stop new users from using user1 for everything even in a case of a single-user blog. If that isn't the case then why rename it? If you're not a new user, and only want to use user1 then you delete user2 because you understand what your doing.

Telling people that the user1 isn't really just a Site Maintenance account, now becomes another explanation when there shouldn't be a need for one imho. Either the standpoint is that it shouldn't be used for daily administration and content, or it doesn't really matter. In which case why rename it, leave it as a suggestion they can find out about if they care to read about best practices.

michaelfavia’s picture

Id like to clarify that my solution to this problem was to get rid of any special consideration for user 1 and make permissions soley dependent on the "administrative" role instead. Then just make a simple check to make sure that there is at least one user with the administrator role remaining when a user is being deleted. If so let them do it. If not either prevent them or tell them they are responsible for the effects of doing so.

I dont know why this isnt an elegant solution to the problem. It gets rid of special casing code (always a plus) and makes roles the true arbiters of permissions as they are in the rest of drupal.

alexanderpas’s picture

first of all, even linux still has root (altrough some distro's have sudo, and a non-acessible root, you can still gain access to it when needed)

secondary, there are currently AFAIK only a couplecases where you would need to verify weither a certain account/user is user/1
- destructive actions on users.
- inside premission functions.
- certain caching situations.
- maintaince tasks. (update etc.)

hardcoding a certain role v.s. a certain user to pass all permissions in in my opinion less secure, and needs more special casing code.

michaelfavia’s picture

The linux setup has very little relevance here imo. Most have removed the root user in favor of a sudo solution anyway.

That aside the determination of whether a user is "user 1" occurs everytime a permission is checked not just in the special cases you mention. But that wasn't the point either. The point was to enable multiple "user 1's" so that development and administration teams are no longer "separate but equal" when it comes to managing sites. It also makes explaining who gets what permissions much easier when you dont haver to explain special cases to new site owners, etc. it generally just simplifies stuff.

alexanderpas’s picture

Most have removed the root user in favor of a sudo solution anyway.

I've never seen a linux dustribution where sudo su didn't give me access to the root account. (not to mention, when you give root it's pass back, it's fully back in action) ;)

the determination of whether a user is "user 1" occurs everytime a permission is checked

which would be 1 function: user_access() which i specified as

- inside premission functions.

on the other points, i think that can be solved by some additional (non-sledgehammer) permissions.

the best way would be, if you make user/1 once, and after giving another user enough (or all) permissions, can put the (ridiculous long) password in a firesafe, and never need it anymore.

fletchgqc’s picture

To me this is 100% clear: michaelfavia is right. Having a "superuser" is simply less secure, regardless of whether linux does it or not. It necesitates password sharing (sudo or no, everyone keeps their linux root passwords somewhere) and accounts that don't pertain to an individual. Are these practices not universally considered bad security?

One slight alternative to michaelfavia's solution: instead of counting how many administrators are left before deleting, add one fixed rule: only administrators can delete administrators. Simple.

jhedstrom’s picture

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

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

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now 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.

ekes’s picture

I think breathing some life into this might be a good idea.

Logging (new) users as user 1 is encouraging bad practice. Special case user 1 is there, I don't see it going away, and if it did it's a whole other question. However, making people use that as their first experience is just either creating additional work for them, throwing a bad User Experience at them, or/and encouraging them to administer the site from that user account.

We consider it best practice that you should make another user, and administrator role, but that's not what is encouraged by the process. Why not make these both automatically? A work around for the e-mail address might be required, or alternative made - but users have that problem already if they aren't always to use user 1.

Now, instead we throw the whole user 1 experience, permission to do everything, on potentially first time user administrators. Then we expect them to RTFM and create users and roles before they do anything else of interest.

Better: Offer up user 1 user name and random password; and
user 2 where the user picks the name, and password and it gets assigned a created administrator role (with assign permissions role), but not all permissions.

Better still: Have the installing user choose what level 'beginner', 'intermediate', 'advanced' permissions the administrator role should have. Then new users aren't thrown into the confusing situation of being able to do all the things, but not knowing where to find the first thing; and advanced users aren't thrown into a dumbed down interface where you have to jump hoops to get to all the things.

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

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now 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.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now 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.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now 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.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now 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.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now 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.

ravimane23’s picture

StatusFileSize
new23.34 KB

Hello All,

I do agree with Ekes that we need to create user 1 and administrator role in installation.

I have installed Drupal 8.6 and while installation I have selected Minimal profile to install instead of Standard profile.
But after site gets setup I dont have permision to add new Roles here.

I tried to update me (as I am user 1 here) and tried to assign "Administrator" role, but unfortunatly there is no pre-defined role.

When I clicked on "User-interface" I got a message that "You do not have any administrative items.", but basically I (as user 1) don't have permission to add those.

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

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.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.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). 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.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now 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.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

aaronmchale’s picture

Status: Active » Closed (outdated)

Marking this as outdated because the usecase for this will no longer be needed once #540008: Add a container parameter that can remove the special behavior of UID#1 is committed.