1
Fork 0
mirror of https://github.com/diced/zipline.git synced 2025-04-11 23:31:17 -05:00

fix: update a user's role

This commit is contained in:
diced 2025-01-26 00:45:48 -08:00
parent 506bab475c
commit 1be72ba9d9
No known key found for this signature in database
GPG key ID: 370BD1BA142842D1

View file

@ -74,7 +74,7 @@ export default fastifyPlugin(
if (role && !z.enum(['USER', 'ADMIN']).safeParse(role).success)
return res.badRequest('Invalid role (USER, ADMIN)');
if (role && !canInteract(req.user.role, role)) return res.forbidden('You cannot create this role');
if (role && !canInteract(req.user.role, role)) return res.forbidden('You cannot assign this role');
let finalQuota:
| {
@ -125,7 +125,7 @@ export default fastifyPlugin(
data: {
...(username && { username }),
...(password && { password: await hashPassword(password) }),
...(role !== undefined && { role: 'USER' }),
...(role !== undefined && { role: role || 'USER' }),
...(avatar && { avatar }),
...(finalQuota && {
quota: {