fix(core): Do not allow admins to generate password-reset links for instance owner (#9488)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-05-22 16:13:56 +02:00
committed by GitHub
parent 8f55bb1457
commit 88b9a4070b
2 changed files with 37 additions and 6 deletions

View File

@@ -115,6 +115,10 @@ export class UsersController {
throw new NotFoundError('User not found');
}
if (req.user.role === 'global:admin' && user.role === 'global:owner') {
throw new ForbiddenError('Admin cannot reset password of global owner');
}
const link = this.authService.generatePasswordResetUrl(user);
return { link };
}