While this usually doesn't matter, this is a pet peeve of mine: after install the user with UID = 1 doesn't have the 'administrator' role. So, if you make something check for that role (ie. a View, Rule, etc), the all powerful super user will be strangely excluded. :-)

We should fix this!

Comments

mglaman’s picture

Status: Active » Needs review
StatusFileSize
new620 bytes

Here's a patch to load the created role and assign UID 1

dsnopek’s picture

Status: Needs review » Needs work

Code looks good, but the identation is off (it's 2 spaces too deep).

mglaman’s picture

Status: Needs work » Needs review
StatusFileSize
new480 bytes

Re-roll!

mglaman’s picture

StatusFileSize
new480 bytes

Uploading proper naming format for branch script.

mglaman’s picture

jfrederick’s picture

StatusFileSize
new497 bytes

The previous patch didn't execute the query, so here's an updated one.

dsnopek’s picture

Status: Needs review » Needs work

@jfrederick: Great catch, thanks!

Sorry to keep sending this one back guys, but I think we should also have a hook_update_N() that does this for existing sites. It'd be great to be able to depend this being set in Apps or add-on modules.

We can do this in the same way as we did with the Help block and _panopoly_install_help_block()

alan-ps’s picture

Status: Needs work » Needs review
StatusFileSize
new1.14 KB

This is a patch (in accordance with the above).

  • dsnopek committed 27a5958 on 7.x-1.x authored by alan-ps
    Issue #2284273 by mglaman, alan-ps, jfrederick: Assign UID 1 to '...
dsnopek’s picture

Status: Needs review » Fixed

Thanks! This code looks great to me, and the switch to db_merge() is better too. Worked in my manual testing with a fresh install and upgrading on an old site. Committed!

Status: Fixed » Closed (fixed)

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

Farliec’s picture

Just for information, for this patch to work, the admin role name must be administrator
Mine was a long time ago renamed in Administrateur (french word) and because it couldn't find the administrator role, the patch 7103 failed and give the error SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'rid' cannot be null.

dsnopek’s picture

Hrm, yes, this probably should have checked for the existance of the role!

If someone makes a patch wrapping this in an if ($admin_role) { ... } then I'll review and commit it :-)

alan-ps’s picture

StatusFileSize
new863 bytes

This is necessary patch :)

dsnopek’s picture

Thanks! Committed :-)