refactor(server): shared link asset access check (#2680)

This commit is contained in:
Jason Rasmussen
2023-06-07 00:34:42 -04:00
committed by GitHub
parent d1b0b64d59
commit 284edd97d6
9 changed files with 39 additions and 38 deletions

View File

@@ -3,4 +3,5 @@ export const IAccessRepository = 'IAccessRepository';
export interface IAccessRepository {
hasPartnerAccess(userId: string, partnerId: string): Promise<boolean>;
hasPartnerAssetAccess(userId: string, assetId: string): Promise<boolean>;
hasSharedLinkAssetAccess(userId: string, assetId: string): Promise<boolean>;
}

View File

@@ -47,10 +47,6 @@ export class SharedLinkCore {
return this.repository.update({ ...link, assets: newAssets });
}
async hasAssetAccess(id: string, assetId: string): Promise<boolean> {
return this.repository.hasAssetAccess(id, assetId);
}
checkDownloadAccess(user: AuthUserDto) {
if (user.isPublicUser && !user.isAllowDownload) {
throw new ForbiddenException();

View File

@@ -9,5 +9,4 @@ export interface ISharedLinkRepository {
create(entity: Omit<SharedLinkEntity, 'id' | 'user'>): Promise<SharedLinkEntity>;
update(entity: Partial<SharedLinkEntity>): Promise<SharedLinkEntity>;
remove(entity: SharedLinkEntity): Promise<void>;
hasAssetAccess(id: string, assetId: string): Promise<boolean>;
}