Fix album permissions by role

This commit is contained in:
jeffvli
2022-11-13 04:56:36 -08:00
parent 4e2325f05d
commit 1a6c4af5df
4 changed files with 28 additions and 17 deletions
+10 -2
View File
@@ -20,14 +20,22 @@ const checkServerPermissions = (
const checkServerFolderPermissions = (
user: AuthUser,
options: { serverFolderId?: string[] | string }
options: { serverFolderId?: string[] | string; serverId: string }
) => {
const { serverFolderId } = options;
const { serverFolderId, serverId } = options;
if (user.isAdmin || !serverFolderId) {
return;
}
const isServerAdmin =
user.serverPermissions.find((s) => s.serverId === serverId)?.type ===
ServerPermissionType.ADMIN;
if (isServerAdmin) {
return;
}
let ids: string[] = [];
if (typeof serverFolderId === 'string') {
ids = [serverFolderId];