There might have been some sort of reason that we didn't do this, but if so, I can't remember what it is. But it's confusing that when you look at user 1's roles, 'administrator' is not in the list.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

David_Rothstein’s picture

Pseudo-duplicate of #572240: Explain in the user interface that user/1 and the "administrator" role are not the same thing (although not quite).

You're welcome to join me in making that argument over there - a few months ago I was not successful in convincing anyone :)

rfay’s picture

I think we should get this done.

dmitrig01’s picture

I couldn't find any APIs. Don't know if this is the right approach (see #572240: Explain in the user interface that user/1 and the "administrator" role are not the same thing - quite interesting issue actually)

dmitrig01’s picture

Status: Active » Needs review
dmitrig01’s picture

a working patch would be nice.

David_Rothstein’s picture

Looks good! Although should probably use the compact form of the DB query (just fields as an associative array, no values). In the earlier patch at the other issue there was an additional bugfix needed to prevent the installer from clobbering any roles assigned to user 1, but I believe I got that committed elsewhere more recently.... in any case, this seems to work as is.

The pros and cons of this patch are discussed in some detail at #572240: Explain in the user interface that user/1 and the "administrator" role are not the same thing. I still think the pros win :)

winston’s picture

I won't do it, but I think this should be marked as a duplicate of #572240 as that is where most of the discussion of the issues is.

I personally think it is a problem for user/1 to be assigned to the administrator role as it implies that you can control the permissions of user/1 when you really can't. More discussion on option in #572240.

dmitrig01’s picture

Would something like this work? (untested)

David_Rothstein’s picture

Yup, that looks good (and I tested that it works).

Codewise, at least, this is RTBC - I guess otherwise there is not quite agreement yet. Part of the idea of #572240: Explain in the user interface that user/1 and the "administrator" role are not the same thing was that this would be accompanied by some user-1-only help text on the permissions page that would alleviate confusion (confusion which exists with or without this patch, in my opinion, though), so maybe it should be a duplicate after all.

Dries’s picture

Status: Needs review » Reviewed & tested by the community

I'm also surprised we don't have an API function for this. I spent 10 minutes looking and couldn't find anything. Seems like a good todo for Drupal 8. Given that, I'm going to mark this as RTBC.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

dmitrig01’s picture

winston’s picture

So would I now file a bug report that modifying the permissions for the administrator role has no affect on whatever I called user/1?

Frankly if I don't someone else I'm sure will (probably after D7 is released).

I'm very disappointed that this was committed without even a tip of the hat to the issues discussed in #572240: Explain in the user interface that user/1 and the "administrator" role are not the same thing.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.