Hi,
If I have a role that is allowed to edit all other roles I'm seeing this error:
Drupal\Core\Database\DatabaseExceptionWrapper: Exception in People (administerusersbyrole)[administerusersbyrole_people]: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right syntax to use near ')
WHERE (( (users_field_data.default_langcode = '1') AND (users_field_data.uid !' at line 2: SELECT COUNT(*) AS expression
FROM
(SELECT 1 AS expression
FROM
{users_field_data} users_field_data
INNER JOIN {user__roles} ur ON ur.entity_id=users_field_data.uid
LEFT OUTER JOIN {user__roles} ur_2 ON ur.entity_id=users_field_data.uid AND ur.roles_target_id IN ()
WHERE (( (users_field_data.default_langcode = :db_condition_placeholder_0) AND (users_field_data.uid != :db_condition_placeholder_1) ))AND (users_field_data.uid :db_condition_placeholder_2) AND (ur_2.entity_id IS NULL )
) subquery; Array
(
[:db_condition_placeholder_0] => 1
[:db_condition_placeholder_1] => 0
[:db_condition_placeholder_2] => 1
)
in Drupal\views\Plugin\views\query\Sql->execute() (line 1488 of /var/www/sites/smg/smg3/docroot/core/modules/views/src/Plugin/views/query/Sql.php).
If I exclude one role, the error goes away.
In administerusersbyrole_query_administerusersbyrole_edit_access_alter(), because there is nothing in $exclude, the query isn't valid.
If I add
if (!$exclude){
return;
}
at line 132, there's no error and the user list looks fine. (or I could wrap the last part in if($exclude)).
I don't know enough about the module to know if that's correct in all situations.
thanks.
Comments
Comment #2
adamps commentedSounds like it is a bug, thanks for the report.
However the circumstances needed to hit the bug are unusual!
Hence marking as minor priority, but I will try to fix at some stage. I think your proposed fix is correct.
Comment #3
andy tawse commentedHi,
Yes, we have no admin role.
And actually, I found that "administer users" was more appropriate later on as the work developed and the bug no longer affected me.
Agree that it's therefore low priority!
thanks
Comment #5
adamps commented