Closed argiepiano closed 2 years ago
Further clarification, as my explanation above may not be completely clear.
The roles for each user are saved in the table users_roles
with two columns: uid and role. The role column is the machine name of the role. The bug I fixed resulted in the human name being saved in the role column instead of the machine name.
To test you can do the following
$u = user_load(1);
)$w = emw('user', $u);
)$w->roles[] = 'editor';
)$w->save();
)If you do the above BEFORE the patch, you'll see human names. After the patch, machine names
Furthermore, this bug really messed up the users_roles
table, creating all sort of errors, for example, for Views that output roles
EMW sets the user roles incorrectly. The problem is the code under
entity_plus_metadata_user_set_properties()
, which follows the role pattern used in D7. In Backdrop, these are different. Setting the roleeditor
for an authenticated user should result in a user's role array:array(0 => 'authenticated', 1 => 'editor)
Instead the resulting user's role array looks like:
array('authenticated' => 'Authenticated', 'editor' => 'Editor')
which results on incorrect "Authenticated" and "Editor" roles being saved in the
user_roles
table for that user.PR coming.