pass access token through API to enforce rank

This commit is contained in:
Hazelnoot 2025-06-21 12:40:37 -04:00
parent fae87e03c0
commit 186c615e3f
166 changed files with 473 additions and 380 deletions

View file

@ -94,13 +94,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private driveService: DriveService,
private roleService: RoleService,
) {
super(meta, paramDef, async (ps, me) => {
super(meta, paramDef, async (ps, me, token) => {
const file = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
if (file == null) {
throw new ApiError(meta.errors.noSuchFile);
}
if (!await this.roleService.isModerator(me) && (file.userId !== me.id)) {
if (!await this.roleService.isModerator(me, token) && (file.userId !== me.id)) {
throw new ApiError(meta.errors.accessDenied);
}