Skip to content

Commit

Permalink
all tests pass locally now!
Browse files Browse the repository at this point in the history
  • Loading branch information
lperson committed Apr 28, 2024
1 parent ab862e5 commit 255fb9c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion __test__/server/api/createOptOut.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-unused-expressions, consistent-return */
import { r } from "../../../src/server/models/";
import { r } from "../../../src/server/models";

import {
setupTest,
Expand Down
8 changes: 6 additions & 2 deletions src/server/api/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ export async function accessRequired(
return;
}
// require a permission at-or-higher than the permission requested
const hasRole = await cacheableData.user.userHasRole(user, orgId, role);
const hasRole = await cacheableData.user.userHasRole(
user,
orgId.toString(),
role
);
if (!hasRole) {
const error = new GraphQLError(
"You are not authorized to access that resource."
Expand Down Expand Up @@ -65,7 +69,7 @@ export async function assignmentRequiredOrAdminRole(
const roleRequired = userHasAssignment ? "TEXTER" : "SUPERVOLUNTEER";
const hasPermission = await cacheableData.user.userHasRole(
user,
orgId,
orgId.toString(),
roleRequired
);
if (!hasPermission) {
Expand Down
2 changes: 1 addition & 1 deletion src/server/api/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ async function editCampaign(id, campaign, loaders, user, origCampaignRecord) {
changed = true;
await accessRequired(
user,
organizationId.toString(),
organizationId,
"SUPERVOLUNTEER",
/* superadmin*/ true
);
Expand Down

0 comments on commit 255fb9c

Please sign in to comment.