mirror of
https://github.com/strapi/strapi.git
synced 2025-09-27 01:09:49 +00:00
Merge pull request #14822 from strapi/fix/users-permissions-user-update
This commit is contained in:
commit
a8f807d27e
@ -18,7 +18,7 @@ const createUserBodySchema = yup.object().shape({
|
|||||||
connect: yup
|
connect: yup
|
||||||
.array()
|
.array()
|
||||||
.of(yup.object().shape({ id: yup.strapiID().required() }))
|
.of(yup.object().shape({ id: yup.strapiID().required() }))
|
||||||
.min(1)
|
.min(1, 'Users must have a role')
|
||||||
.required(),
|
.required(),
|
||||||
})
|
})
|
||||||
.required()
|
.required()
|
||||||
@ -36,7 +36,16 @@ const updateUserBodySchema = yup.object().shape({
|
|||||||
connect: yup
|
connect: yup
|
||||||
.array()
|
.array()
|
||||||
.of(yup.object().shape({ id: yup.strapiID().required() }))
|
.of(yup.object().shape({ id: yup.strapiID().required() }))
|
||||||
.min(1)
|
.required(),
|
||||||
|
disconnect: yup
|
||||||
|
.array()
|
||||||
|
.test('CheckDisconnect', 'Cannot remove role', function test(disconnectValue) {
|
||||||
|
if (value.connect.length === 0 && disconnectValue.length > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
})
|
||||||
.required(),
|
.required(),
|
||||||
})
|
})
|
||||||
: yup.strapiID()
|
: yup.strapiID()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user