rename and separate ALBUM_WRITE as ADD_ASSET and REMOVE_ASSET

This commit is contained in:
mgabor
2024-04-21 18:19:27 +02:00
parent 6b075c21b6
commit 9fc61032c3
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -21,9 +21,9 @@ export enum Permission {
// ALBUM_CREATE = 'album.create',
ALBUM_READ = 'album.read',
ALBUM_WRITE = 'album.write',
ALBUM_UPDATE = 'album.update',
ALBUM_DELETE = 'album.delete',
ALBUM_ADD_ASSET = 'album.addAsset',
ALBUM_REMOVE_ASSET = 'album.removeAsset',
ALBUM_SHARE = 'album.share',
ALBUM_DOWNLOAD = 'album.download',
@@ -144,7 +144,7 @@ export class AccessCore {
: new Set();
}
case Permission.ALBUM_WRITE: {
case Permission.ALBUM_ADD_ASSET: {
return sharedLink.allowUpload
? await this.repository.album.checkSharedLinkAccess(sharedLinkId, ids)
: new Set();
@@ -231,7 +231,7 @@ export class AccessCore {
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 isShared = await this.repository.album.checkSharedAlbumAccess(
auth.user.id,
+2 -2
View File
@@ -169,7 +169,7 @@ export class AlbumService {
async addAssets(auth: AuthDto, id: string, dto: BulkIdsDto): Promise<BulkIdResponseDto[]> {
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(
auth,
@@ -192,7 +192,7 @@ export class AlbumService {
async removeAssets(auth: AuthDto, id: string, dto: BulkIdsDto): Promise<BulkIdResponseDto[]> {
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(
auth,