Skip to content

Commit 430d8ca

Browse files
committed
linting and tests
1 parent bf13350 commit 430d8ca

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/backend/src/services/organizations.services.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Organization, User } from '@prisma/client';
2-
import { LinkCreateArgs, ProjectPreview, isAdmin, isMember } from 'shared';
2+
import { LinkCreateArgs, ProjectPreview, RoleEnum, isAdmin, isAtLeastRank } from 'shared';
33
import prisma from '../prisma/prisma';
44
import {
55
AccessDeniedAdminOnlyException,
@@ -424,7 +424,7 @@ export default class OrganizationsService {
424424
if (organization.dateDeleted) {
425425
throw new DeletedException('Organization', organizationId);
426426
}
427-
if (!(await userHasPermission(submitter.userId, organization.organizationId, isMember))) {
427+
if (!(await userHasPermission(submitter.userId, organizationId, (role) => isAtLeastRank(RoleEnum.MEMBER, role)))) {
428428
throw new AccessDeniedException("Only members of an organization can retrieve it's guide link");
429429
}
430430
return organization.partReviewGuideLink;

src/backend/src/services/part-review.services.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Organization, User } from '@prisma/client';
2-
import { userHasPermission, getUserRole } from '../utils/users.utils';
2+
import { userHasPermission } from '../utils/users.utils';
33
import {
44
FrequentlyAskedQuestion,
55
isAdmin,
@@ -857,7 +857,7 @@ export default class PartReviewService {
857857
* @returns the created and transformed PartReviewRequest
858858
*/
859859
static async createPartReviewRequest(partId: string, requester: User, reviewerId: string, organizationId: string) {
860-
const part = await PartReviewService.getPartWithQueryArgs(partId, requester.userId, organizationId);
860+
await PartReviewService.getPartWithQueryArgs(partId, requester.userId, organizationId);
861861

862862
if (!userHasPermission(requester.userId, organizationId, (role) => isAtLeastRank(RoleEnum.MEMBER, role))) {
863863
throw new AccessDeniedGuestException('Guests must be at least members to access this part.');

0 commit comments

Comments
 (0)