Skip to content

Commit

Permalink
fix(server): admin access to edit library
Browse files Browse the repository at this point in the history
  • Loading branch information
alextran1502 committed Mar 7, 2024
1 parent 9b1a379 commit 307ffc9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions server/src/domain/access/access.core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,25 @@ export class AccessCore {
}

case Permission.LIBRARY_READ: {
if (auth.user.isAdmin) {
return new Set(ids);
}
const isOwner = await this.repository.library.checkOwnerAccess(auth.user.id, ids);
const isPartner = await this.repository.library.checkPartnerAccess(auth.user.id, setDifference(ids, isOwner));
return setUnion(isOwner, isPartner);
}

case Permission.LIBRARY_UPDATE: {
if (auth.user.isAdmin) {
return new Set(ids);
}
return await this.repository.library.checkOwnerAccess(auth.user.id, ids);
}

case Permission.LIBRARY_DELETE: {
if (auth.user.isAdmin) {
return new Set(ids);
}
return await this.repository.library.checkOwnerAccess(auth.user.id, ids);
}

Expand Down

0 comments on commit 307ffc9

Please sign in to comment.