1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-06-28 05:40:11 +02:00

fix: reverse shares couldn't be created unauthenticated

This commit is contained in:
Elias Schneider 2023-11-11 18:56:52 +01:00
parent 5503e7a54f
commit 966ce261cb
No known key found for this signature in database
GPG Key ID: 07E623B294202B6C

View File

@ -19,7 +19,6 @@ export class ShareOwnerGuard extends JwtGuard {
}
async canActivate(context: ExecutionContext) {
if (!(await super.canActivate(context))) return false;
const request: Request = context.switchToHttp().getRequest();
const shareId = Object.prototype.hasOwnProperty.call(
@ -38,6 +37,8 @@ export class ShareOwnerGuard extends JwtGuard {
if (!share.creatorId) return true;
if (!(await super.canActivate(context))) return false;
return share.creatorId == (request.user as User).id;
}
}