Using Strapi version 4.8.
On the schema.json
of ‘users-permissions’ plugin at path src/extensions/users-permissions/content-types/user
I modified the user-role relation to ‘manyToMany’:
"role": {
"type": "relation",
"relation": "manyToMany",
"target": "plugin::users-permissions.role",
"inversedBy": "users",
"configurable": false
},
As seen on an other topic: Users and Permissions Plugin: How to assign multiple roles to single end-user
That worked as expected.
But now I got an error when I try to delete one role on a user that already has multiple roles assigned. I am not trying to delete all the roles that one user has, just if it has 3 roles delete one or two roles but always leave the user with at least one role.
The error thrown by the Strapi BackOffice is:
{
"data": null,
"error": {
"status": 400,
"name": "ValidationError",
"message": "Cannot remove role",
"details": {
"errors": [
{
"path": [
"role",
"disconnect"
],
"message": "Cannot remove role",
"name": "ValidationError"
}
]
}
}
}
Is there any solution? On newer versions it has been fixed?
Thanks