refactor(server): access permissions (#2910)

* refactor: access repo interface

* feat: access core

* fix: allow shared links to add to a shared link

* chore: comment out unused code

* fix: pr feedback

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Jason Rasmussen
2023-06-28 09:56:24 -04:00
committed by GitHub
parent df1e8679d9
commit e98398cab8
11 changed files with 400 additions and 273 deletions

View File

@@ -1,14 +1,28 @@
import { IAccessRepository } from '@app/domain';
export const newAccessRepositoryMock = (): jest.Mocked<IAccessRepository> => {
export type IAccessRepositoryMock = {
asset: jest.Mocked<IAccessRepository['asset']>;
album: jest.Mocked<IAccessRepository['album']>;
library: jest.Mocked<IAccessRepository['library']>;
};
export const newAccessRepositoryMock = (): IAccessRepositoryMock => {
return {
hasPartnerAccess: jest.fn(),
asset: {
hasOwnerAccess: jest.fn(),
hasAlbumAccess: jest.fn(),
hasPartnerAccess: jest.fn(),
hasSharedLinkAccess: jest.fn(),
},
hasAlbumAssetAccess: jest.fn(),
hasOwnerAssetAccess: jest.fn(),
hasPartnerAssetAccess: jest.fn(),
hasSharedLinkAssetAccess: jest.fn(),
album: {
hasOwnerAccess: jest.fn(),
hasSharedAlbumAccess: jest.fn(),
hasSharedLinkAccess: jest.fn(),
},
hasAlbumOwnerAccess: jest.fn(),
library: {
hasPartnerAccess: jest.fn(),
},
};
};