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:
parent
506bab475c
commit
1be72ba9d9
1 changed files with 2 additions and 2 deletions
|
@ -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: {
|
||||
|
|
Loading…
Add table
Reference in a new issue