Fix server folder permissions by role

This commit is contained in:
jeffvli
2022-11-13 03:06:24 -08:00
parent 135a8d7a45
commit 4e2325f05d
9 changed files with 65 additions and 22 deletions
+8
View File
@@ -1,3 +1,4 @@
import { ServerPermissionType } from '@prisma/client';
import { AuthUser } from '@/middleware';
import { ApiError } from '@/utils';
import { prisma } from '@lib/prisma';
@@ -62,6 +63,13 @@ const getAvailableServerFolderIds = async (
const serverFoldersWithAccess = await prisma.serverFolder.findMany({
where: {
OR: [
{
server: {
serverPermissions: {
some: { type: ServerPermissionType.ADMIN, userId: user.id },
},
},
},
{
AND: [
{