fix: fix no perm

This commit is contained in:
Methapon Metanipat 2024-09-05 11:03:45 +07:00
parent a8ad8e37d4
commit 5d32e2dca5

View file

@ -381,7 +381,7 @@ export class UserController extends Controller {
const THROW_PERM_MSG = "You do not have permission to perform this action.";
const THROW_PERM_CODE = "noPermission";
if (setRoleIndex < userRoleIndex) {
if (setRoleIndex !== -1 && setRoleIndex < userRoleIndex) {
throw new HttpError(HttpStatus.FORBIDDEN, THROW_PERM_MSG, THROW_PERM_CODE);
}
if (!globalAllow(req.user)) {