mirror of
https://github.com/swissmakers/swiss-datashare.git
synced 2026-04-11 10:27:01 +02:00
fix: reverse shares couldn't be created unauthenticated
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user