Skip to content

Commit

Permalink
Fix logic error in verifyCanViewAndEdit
Browse files Browse the repository at this point in the history
project from db was called `org`
passed `org.Id` when needed to pass `project.OrganizationId`
  • Loading branch information
FyreByrd committed Jan 27, 2025
1 parent e4083a9 commit 95804ca
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ import { canModifyProject } from './common';
export async function verifyCanViewAndEdit(user: Session, projectId: number) {
// Editing is allowed if the user owns the project, or if the user is an organization
// admin for the project's organization, or if the user is a super admin
const org = await prisma.projects.findUnique({
const project = await prisma.projects.findUnique({
where: {
Id: projectId
},
select: {
Id: true,
OwnerId: true
OwnerId: true,
OrganizationId: true
}
});
if (!org) return false;
return canModifyProject(user, org.OwnerId, org.Id);
if (!project) return false;
return canModifyProject(user, project.OwnerId, project.OrganizationId);
}

export function projectFilter(args: {
Expand Down

0 comments on commit 95804ca

Please sign in to comment.