@@ -236,30 +236,29 @@ private function saveAdminUserRole($adminId)
236
236
}
237
237
238
238
/**
239
- * Gets the "Administrators" role id, the special role created by data fixture in Authorization module.
239
+ * Gets an administrators role id, the special role created by data fixture in Authorization module.
240
240
*
241
- * @return int The id of the Administrators role
242
- * @throws \Exception If Administrators role not found or problem connecting with database.
241
+ * @return int The id of an administrators role
242
+ * @throws \Exception If an administrators role not found or problem connecting with database.
243
243
*/
244
244
private function retrieveAdministratorsRoleId ()
245
245
{
246
- // Get Administrators role id to use as parent_id
246
+ // Get an administrators role id to use as parent_id
247
247
$ administratorsRoleData = [
248
248
'parent_id ' => 0 ,
249
249
'tree_level ' => 1 ,
250
250
'role_type ' => Group::ROLE_TYPE ,
251
251
'user_id ' => 0 ,
252
252
'user_type ' => UserContextInterface::USER_TYPE_ADMIN ,
253
- 'role_name ' => 'Administrators ' ,
254
253
];
255
254
$ result = $ this ->connection ->fetchRow (
256
255
'SELECT * FROM ' . $ this ->getTableName ('authorization_role ' ) . ' ' .
257
256
'WHERE parent_id = :parent_id AND tree_level = :tree_level AND role_type = :role_type AND ' .
258
- 'user_id = :user_id AND user_type = :user_type AND role_name = :role_name ' ,
257
+ 'user_id = :user_id AND user_type = :user_type ORDER BY sort_order DESC ' ,
259
258
$ administratorsRoleData
260
259
);
261
260
if (empty ($ result )) {
262
- throw new \Exception ('No Administrators role was found, data fixture needs to be run ' );
261
+ throw new \Exception ('No administrators role was found, data fixture needs to be run ' );
263
262
} else {
264
263
// Found at least one, use first
265
264
return $ result ['role_id ' ];
0 commit comments