rename and separate ALBUM_WRITE as ADD_ASSET and REMOVE_ASSET
This commit is contained in:
@@ -21,9 +21,9 @@ export enum Permission {
|
|||||||
|
|
||||||
// ALBUM_CREATE = 'album.create',
|
// ALBUM_CREATE = 'album.create',
|
||||||
ALBUM_READ = 'album.read',
|
ALBUM_READ = 'album.read',
|
||||||
ALBUM_WRITE = 'album.write',
|
|
||||||
ALBUM_UPDATE = 'album.update',
|
ALBUM_UPDATE = 'album.update',
|
||||||
ALBUM_DELETE = 'album.delete',
|
ALBUM_DELETE = 'album.delete',
|
||||||
|
ALBUM_ADD_ASSET = 'album.addAsset',
|
||||||
ALBUM_REMOVE_ASSET = 'album.removeAsset',
|
ALBUM_REMOVE_ASSET = 'album.removeAsset',
|
||||||
ALBUM_SHARE = 'album.share',
|
ALBUM_SHARE = 'album.share',
|
||||||
ALBUM_DOWNLOAD = 'album.download',
|
ALBUM_DOWNLOAD = 'album.download',
|
||||||
@@ -144,7 +144,7 @@ export class AccessCore {
|
|||||||
: new Set();
|
: new Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
case Permission.ALBUM_WRITE: {
|
case Permission.ALBUM_ADD_ASSET: {
|
||||||
return sharedLink.allowUpload
|
return sharedLink.allowUpload
|
||||||
? await this.repository.album.checkSharedLinkAccess(sharedLinkId, ids)
|
? await this.repository.album.checkSharedLinkAccess(sharedLinkId, ids)
|
||||||
: new Set();
|
: new Set();
|
||||||
@@ -231,7 +231,7 @@ export class AccessCore {
|
|||||||
return setUnion(isOwner, isShared);
|
return setUnion(isOwner, isShared);
|
||||||
}
|
}
|
||||||
|
|
||||||
case Permission.ALBUM_WRITE: {
|
case Permission.ALBUM_ADD_ASSET: {
|
||||||
const isOwner = await this.repository.album.checkOwnerAccess(auth.user.id, ids);
|
const isOwner = await this.repository.album.checkOwnerAccess(auth.user.id, ids);
|
||||||
const isShared = await this.repository.album.checkSharedAlbumAccess(
|
const isShared = await this.repository.album.checkSharedAlbumAccess(
|
||||||
auth.user.id,
|
auth.user.id,
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ export class AlbumService {
|
|||||||
|
|
||||||
async addAssets(auth: AuthDto, id: string, dto: BulkIdsDto): Promise<BulkIdResponseDto[]> {
|
async addAssets(auth: AuthDto, id: string, dto: BulkIdsDto): Promise<BulkIdResponseDto[]> {
|
||||||
const album = await this.findOrFail(id, { withAssets: false });
|
const album = await this.findOrFail(id, { withAssets: false });
|
||||||
await this.access.requirePermission(auth, Permission.ALBUM_WRITE, id);
|
await this.access.requirePermission(auth, Permission.ALBUM_ADD_ASSET, id);
|
||||||
|
|
||||||
const results = await addAssets(
|
const results = await addAssets(
|
||||||
auth,
|
auth,
|
||||||
@@ -192,7 +192,7 @@ export class AlbumService {
|
|||||||
async removeAssets(auth: AuthDto, id: string, dto: BulkIdsDto): Promise<BulkIdResponseDto[]> {
|
async removeAssets(auth: AuthDto, id: string, dto: BulkIdsDto): Promise<BulkIdResponseDto[]> {
|
||||||
const album = await this.findOrFail(id, { withAssets: false });
|
const album = await this.findOrFail(id, { withAssets: false });
|
||||||
|
|
||||||
await this.access.requirePermission(auth, Permission.ALBUM_WRITE, id);
|
await this.access.requirePermission(auth, Permission.ALBUM_REMOVE_ASSET, id);
|
||||||
|
|
||||||
const results = await removeAssets(
|
const results = await removeAssets(
|
||||||
auth,
|
auth,
|
||||||
|
|||||||
Reference in New Issue
Block a user