Yes, that is expected, since the Minimal profile creates less entities than the Standard profile. You can see that by comparing the config/install directory in the first profile with the config/install directory in the latter profile.
As per creating the role from the user interface, that would be possible, but the created role would be a role like the others, while the Administrator role created from the Standard profile automatically gets all the permissions defined in a Drupal site. In fact, Role::hasPermission()
uses the following code.
if ($this->isAdmin()) {
return TRUE;
}
return in_array($permission, $this->permissions);
For the Administrator role, $this->isAdmin()
always return TRUE
; for every role you create from the user interface, $this->isAdmin()
would return FALSE
.
If you need that role, and you cannot reinstall Drupal using the Standard profile, you can create a custom module, for which you create a config/optional/user.role.administrator.yml file with the following content.
langcode: en
status: true
dependencies:
enforced:
module:
- yourmodule
id: administrator
label: Administrator
weight: 2
is_admin: true
permissions: { }
(Replace yourmodule with the module name.)
When the module is installed, the role will be created. Since the file contains is_admin: true
, the role will have all the permissions, automatically, like the Administrator role created by the Standard profile.
The alternative method that doesn't involve writing modules is importing the user.role.administrator.yml file in the site. The content of the file is similar to the content of the file I previously suggested, with the exception that there aren't dependencies.
langcode: en
status: true
dependencies: { }
id: administrator
label: Administrator
weight: 2
is_admin: true
permissions: { }
I would use the custom module method if there are other entities/bundles that you normally create when installing Drupal for a new site.
If instead you don't have the need to create other entities/bundles, importing a single file is quicker.
If you installed Drush, with drush config-edit user.role.administrator
you can edit that file and set is_admin
to true
.