Move functionality of user #1 to an administrative user role that can be assigned to any user.

Comments

philippejadin’s picture

Note (for later) that update.php checks if user id == 1 and so a role woudn't work for update.php

Maybe this ($user->uid == 1) is used elsewhere

How to handle this should be discussed as well

Anonymous’s picture

Yes it is used in more than several places and we need to update each one to use the role instead. The killer will be the ppl who've used PHP within the nodes, blocks, etc. to filter on $user->uid == 1. We may need to provide an upgrade path for those.

Chris Johnson’s picture

Interestingly, I'm only finding 3 places in core (one in update.php, 2 in user.module) where uid == 1 is used. Additionally, there are 4 places where uid != 1 is used (2 in file.inc and 1 each in block.module and upload.module).

So changing core won't be hard.

There are probably a couple hundred in contrib modules, though.

Anonymous’s picture

Well, if it's that simple we might just look at getting a patch out next week. For round one we'll just make sure that uid == 1 always has the administrator role to make contrib life easier. Round two can remove that assurance if we really want to. Do we want the administrator role->rid to be zero to make the upgrade easier? Or should we make it three and roll up each sequential rid to make room for it?

jalbro’s picture

I was just going to post a question on the forum about this issue, but I found this. I'm glad someone is working on it. The way this is currently implemented doesn't make it clear to the user what is going on or how to extend the roles well. I mean it *feels* like there should be a default administrator role, and it is confusing that there isn't one. This is a great fix.

Is there any "vote for this feature" system for Drupal?

Any way to push for it earlier in the tree? Either version 5 or 6?

-Jeff

Anonymous’s picture

Is there any "vote for this feature" system for Drupal?
You just did it.

Any way to push for it earlier in the tree? Either version 5 or 6?
No. A module containing a patch to core is the only method for this. I wouldn't want to deal with that though. There is an Admin Role module now that might help; I haven't looked at it.

mlncn’s picture

This is technically a duplicate of http://drupal.org/node/1597

As noted over there, I'm pushing a related, but distinct approach:

I have a request in for a core admin role that does not clone the superuser. UID 1 would still be special but people would be encouraged to use another account with an admin role for regular administration.

[My proposed] approach is not mutually exclusive with [the proposal here], which uncouples "super-admin" powers from UID 1, and could even be seen as complementary, giving us these roles: anonymous, authenticated, admin, and (not seen on the user permissions page since it would have all permissions) superadmin.

http://drupal.org/project/adminrole approximates this which is why I consider the more pressing need to get an admin role that can be a superuser equivalent or a step below that, at the users choice, but will encourage people to move away from reliance on the superuser for all administrative tasks and allow modules to give "administer X" permissions to the admin role, getting around the recurring "why don't I see the module I just enabled? oh right I have to assign its permissions" foolishness.

That issue: http://drupal.org/node/182023

mlncn’s picture

Status: Active » Closed (duplicate)

As noted, duplicate of http://drupal.org/node/1597

benjamin, Agaric Design Collective