User 1 not super-user and no role named 'administrator'

Created on 17 February 2025, about 2 months ago

Problem/Motivation

Follow-up to 🐛 User 1 isn't the super user anymore in Drupal >= 10.3 Active (and Use user 1 for ::getAdministrator if security.enable_super_user is set to true Active ).

The solution to finding an administration user if user 1 is to find the first user with a role called 'administrator' https://git.drupalcode.org/project/default_content_deploy/-/blob/c8f1056... It is not a given that there is a role called 'administrator'.

Steps to reproduce

Install Drupal minimal, build a site adding a administrator role that is not called 'administrator'; or delete the 'administrator' role provided, and make another one. Also set 'security.enable_super_user' to false.

Try to use default content deploy drush commands.

Proposed resolution

Not sure if another project, or drush itself, has already tackled this? If not a resolution could be: Load the roles by is_admin. Then load first user that has any of these named roles.

Remaining tasks

API changes

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

🇳🇱Netherlands ekes

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024