refactor: updated permission service for projects to check for operation type as well

This commit is contained in:
=
2025-01-14 23:26:18 +05:30
parent 0cef728617
commit 989065ba34
46 changed files with 1603 additions and 1257 deletions
+5 -3
View File
@@ -8,6 +8,7 @@ import {
OrgMembershipRole,
OrgMembershipStatus,
ProjectMembershipRole,
ProjectOperationType,
ProjectVersion,
SecretKeyEncoding,
TableName,
@@ -773,13 +774,14 @@ export const orgServiceFactory = ({
// if there exist no project membership we set is as given by the request
for await (const project of projectsToInvite) {
const projectId = project.id;
const { permission: projectPermission } = await permissionService.getProjectPermission(
const { permission: projectPermission } = await permissionService.getProjectPermission({
actor,
actorId,
projectId,
actorAuthMethod,
actorOrgId
);
actorOrgId,
projectOperationType: ProjectOperationType.Global
});
ForbiddenError.from(projectPermission).throwUnlessCan(
ProjectPermissionActions.Create,
ProjectPermissionSub.Member