fix(server): admin access to edit library

This commit is contained in:
Alex Tran 2024-03-07 12:03:21 -06:00
parent 9b1a379fa6
commit 307ffc990d

View File

@ -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);
}