mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 19:16:22 +00:00
feat: updated to enum ActionProjectType
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { ForbiddenError } from "@casl/ability";
|
||||
|
||||
import { ProjectOperationType } from "@app/db/schemas";
|
||||
import { ActionProjectType } from "@app/db/schemas";
|
||||
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
|
||||
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
|
||||
import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
|
||||
@@ -93,7 +93,7 @@ export const accessApprovalPolicyServiceFactory = ({
|
||||
projectId: project.id,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
@@ -199,7 +199,7 @@ export const accessApprovalPolicyServiceFactory = ({
|
||||
projectId: project.id,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
|
||||
const accessApprovalPolicies = await accessApprovalPolicyDAL.find({ projectId: project.id, deletedAt: null });
|
||||
@@ -250,7 +250,7 @@ export const accessApprovalPolicyServiceFactory = ({
|
||||
projectId: accessApprovalPolicy.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.SecretApproval);
|
||||
@@ -334,7 +334,7 @@ export const accessApprovalPolicyServiceFactory = ({
|
||||
projectId: policy.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Delete,
|
||||
@@ -385,7 +385,7 @@ export const accessApprovalPolicyServiceFactory = ({
|
||||
projectId: project.id,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
if (!membership) {
|
||||
throw new ForbiddenRequestError({ message: "You are not a member of this project" });
|
||||
@@ -425,7 +425,7 @@ export const accessApprovalPolicyServiceFactory = ({
|
||||
projectId: policy.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretApproval);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import slugify from "@sindresorhus/slugify";
|
||||
import ms from "ms";
|
||||
|
||||
import { ProjectMembershipRole, ProjectOperationType } from "@app/db/schemas";
|
||||
import { ActionProjectType, ProjectMembershipRole } from "@app/db/schemas";
|
||||
import { getConfig } from "@app/lib/config/env";
|
||||
import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
|
||||
import { alphaNumericNanoId } from "@app/lib/nanoid";
|
||||
@@ -106,7 +106,7 @@ export const accessApprovalRequestServiceFactory = ({
|
||||
projectId: project.id,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
if (!membership) {
|
||||
throw new ForbiddenRequestError({ message: "You are not a member of this project" });
|
||||
@@ -280,7 +280,7 @@ export const accessApprovalRequestServiceFactory = ({
|
||||
projectId: project.id,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
if (!membership) {
|
||||
throw new ForbiddenRequestError({ message: "You are not a member of this project" });
|
||||
@@ -326,7 +326,7 @@ export const accessApprovalRequestServiceFactory = ({
|
||||
projectId: accessApprovalRequest.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
|
||||
if (!membership) {
|
||||
@@ -431,7 +431,7 @@ export const accessApprovalRequestServiceFactory = ({
|
||||
projectId: project.id,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
if (!membership) {
|
||||
throw new ForbiddenRequestError({ message: "You are not a member of this project" });
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ForbiddenError } from "@casl/ability";
|
||||
|
||||
import { ProjectOperationType } from "@app/db/schemas";
|
||||
import { ActionProjectType } from "@app/db/schemas";
|
||||
import { getConfig } from "@app/lib/config/env";
|
||||
import { BadRequestError } from "@app/lib/errors";
|
||||
|
||||
@@ -33,7 +33,7 @@ export const auditLogServiceFactory = ({
|
||||
projectId: filter.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.AuditLogs);
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { ForbiddenError } from "@casl/ability";
|
||||
import * as x509 from "@peculiar/x509";
|
||||
|
||||
import { ProjectOperationType } from "@app/db/schemas";
|
||||
import { ActionProjectType } from "@app/db/schemas";
|
||||
import { TCertificateAuthorityCrlDALFactory } from "@app/ee/services/certificate-authority-crl/certificate-authority-crl-dal";
|
||||
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
|
||||
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
|
||||
@@ -73,7 +73,7 @@ export const certificateAuthorityCrlServiceFactory = ({
|
||||
projectId: ca.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.CertificateManager
|
||||
projectOperationType: ActionProjectType.CertificateManager
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ForbiddenError, subject } from "@casl/ability";
|
||||
import ms from "ms";
|
||||
|
||||
import { ProjectOperationType, SecretKeyEncoding } from "@app/db/schemas";
|
||||
import { ActionProjectType, SecretKeyEncoding } from "@app/db/schemas";
|
||||
import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
|
||||
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
|
||||
import {
|
||||
@@ -73,7 +73,7 @@ export const dynamicSecretLeaseServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionDynamicSecretActions.Lease,
|
||||
@@ -153,7 +153,7 @@ export const dynamicSecretLeaseServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionDynamicSecretActions.Lease,
|
||||
@@ -233,7 +233,7 @@ export const dynamicSecretLeaseServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionDynamicSecretActions.Lease,
|
||||
@@ -303,7 +303,7 @@ export const dynamicSecretLeaseServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionDynamicSecretActions.Lease,
|
||||
@@ -346,7 +346,7 @@ export const dynamicSecretLeaseServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionDynamicSecretActions.Lease,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ForbiddenError, subject } from "@casl/ability";
|
||||
|
||||
import { ProjectOperationType, SecretKeyEncoding } from "@app/db/schemas";
|
||||
import { ActionProjectType, SecretKeyEncoding } from "@app/db/schemas";
|
||||
import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
|
||||
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
|
||||
import {
|
||||
@@ -79,7 +79,7 @@ export const dynamicSecretServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionDynamicSecretActions.CreateRootCredential,
|
||||
@@ -151,7 +151,7 @@ export const dynamicSecretServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionDynamicSecretActions.EditRootCredential,
|
||||
@@ -235,7 +235,7 @@ export const dynamicSecretServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionDynamicSecretActions.DeleteRootCredential,
|
||||
@@ -296,7 +296,7 @@ export const dynamicSecretServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionDynamicSecretActions.ReadRootCredential,
|
||||
@@ -347,7 +347,7 @@ export const dynamicSecretServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
|
||||
// verify user has access to each env in request
|
||||
@@ -391,7 +391,7 @@ export const dynamicSecretServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionDynamicSecretActions.ReadRootCredential,
|
||||
@@ -440,7 +440,7 @@ export const dynamicSecretServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionDynamicSecretActions.ReadRootCredential,
|
||||
@@ -472,7 +472,7 @@ export const dynamicSecretServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod: actor.authMethod,
|
||||
actorOrgId: actor.orgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
|
||||
const userAccessibleFolderMappings = folderMappings.filter(({ path, environment }) =>
|
||||
@@ -518,7 +518,7 @@ export const dynamicSecretServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
|
||||
// verify user has access to each env in request
|
||||
|
||||
+10
-10
@@ -2,7 +2,7 @@ import { ForbiddenError, subject } from "@casl/ability";
|
||||
import { packRules } from "@casl/ability/extra";
|
||||
import ms from "ms";
|
||||
|
||||
import { ProjectOperationType, TableName } from "@app/db/schemas";
|
||||
import { ActionProjectType, TableName } from "@app/db/schemas";
|
||||
import { isAtLeastAsPrivileged } from "@app/lib/casl";
|
||||
import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
|
||||
import { unpackPermissions } from "@app/server/routes/santizedSchemas/permission";
|
||||
@@ -61,7 +61,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Edit,
|
||||
@@ -73,7 +73,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
|
||||
// we need to validate that the privilege given is not higher than the assigning users permission
|
||||
@@ -143,7 +143,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Edit,
|
||||
@@ -155,7 +155,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
|
||||
// we need to validate that the privilege given is not higher than the assigning users permission
|
||||
@@ -225,7 +225,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Edit,
|
||||
@@ -237,7 +237,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
const hasRequiredPriviledges = isAtLeastAsPrivileged(permission, identityRolePermission);
|
||||
if (!hasRequiredPriviledges)
|
||||
@@ -272,7 +272,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Read,
|
||||
@@ -307,7 +307,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Read,
|
||||
@@ -343,7 +343,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Read,
|
||||
|
||||
+9
-9
@@ -2,7 +2,7 @@ import { ForbiddenError, MongoAbility, RawRuleOf, subject } from "@casl/ability"
|
||||
import { PackRule, packRules, unpackRules } from "@casl/ability/extra";
|
||||
import ms from "ms";
|
||||
|
||||
import { ProjectOperationType } from "@app/db/schemas";
|
||||
import { ActionProjectType } from "@app/db/schemas";
|
||||
import { isAtLeastAsPrivileged } from "@app/lib/casl";
|
||||
import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
|
||||
import { UnpackedPermissionSchema } from "@app/server/routes/santizedSchemas/permission";
|
||||
@@ -69,7 +69,7 @@ export const identityProjectAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Edit,
|
||||
@@ -82,7 +82,7 @@ export const identityProjectAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
|
||||
// we need to validate that the privilege given is not higher than the assigning users permission
|
||||
@@ -152,7 +152,7 @@ export const identityProjectAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
@@ -166,7 +166,7 @@ export const identityProjectAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
|
||||
// we need to validate that the privilege given is not higher than the assigning users permission
|
||||
@@ -253,7 +253,7 @@ export const identityProjectAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Edit,
|
||||
@@ -266,7 +266,7 @@ export const identityProjectAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
const hasRequiredPriviledges = isAtLeastAsPrivileged(permission, identityRolePermission);
|
||||
if (!hasRequiredPriviledges)
|
||||
@@ -312,7 +312,7 @@ export const identityProjectAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Read,
|
||||
@@ -355,7 +355,7 @@ export const identityProjectAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: identityProjectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ProjectOperationType } from "@app/db/schemas";
|
||||
import { ActionProjectType } from "@app/db/schemas";
|
||||
import { ActorAuthMethod, ActorType } from "@app/services/auth/auth-type";
|
||||
|
||||
export type TBuildProjectPermissionDTO = {
|
||||
@@ -15,7 +15,7 @@ export type TGetUserProjectPermissionArg = {
|
||||
userId: string;
|
||||
projectId: string;
|
||||
authMethod: ActorAuthMethod;
|
||||
projectOperationType: ProjectOperationType;
|
||||
projectOperationType: ActionProjectType;
|
||||
userOrgId?: string;
|
||||
};
|
||||
|
||||
@@ -23,14 +23,14 @@ export type TGetIdentityProjectPermissionArg = {
|
||||
identityId: string;
|
||||
projectId: string;
|
||||
identityOrgId?: string;
|
||||
projectOperationType: ProjectOperationType;
|
||||
projectOperationType: ActionProjectType;
|
||||
};
|
||||
|
||||
export type TGetServiceTokenProjectPermissionArg = {
|
||||
serviceTokenId: string;
|
||||
projectId: string;
|
||||
actorOrgId?: string;
|
||||
projectOperationType: ProjectOperationType;
|
||||
projectOperationType: ActionProjectType;
|
||||
};
|
||||
|
||||
export type TGetProjectPermissionArg = {
|
||||
@@ -39,5 +39,5 @@ export type TGetProjectPermissionArg = {
|
||||
projectId: string;
|
||||
actorAuthMethod: ActorAuthMethod;
|
||||
actorOrgId?: string;
|
||||
projectOperationType: ProjectOperationType;
|
||||
projectOperationType: ActionProjectType;
|
||||
};
|
||||
|
||||
@@ -4,9 +4,9 @@ import { MongoQuery } from "@ucast/mongo2js";
|
||||
import handlebars from "handlebars";
|
||||
|
||||
import {
|
||||
ActionProjectType,
|
||||
OrgMembershipRole,
|
||||
ProjectMembershipRole,
|
||||
ProjectOperationType,
|
||||
ServiceTokenScopes,
|
||||
TIdentityProjectMemberships,
|
||||
TProjectMemberships
|
||||
@@ -227,10 +227,7 @@ export const permissionServiceFactory = ({
|
||||
|
||||
validateOrgSSO(authMethod, userProjectPermission.orgAuthEnforced);
|
||||
|
||||
if (
|
||||
projectOperationType !== ProjectOperationType.Global &&
|
||||
projectOperationType !== userProjectPermission.projectType
|
||||
) {
|
||||
if (projectOperationType !== ActionProjectType.Any && projectOperationType !== userProjectPermission.projectType) {
|
||||
throw new BadRequestError({
|
||||
message: `The project is of type ${userProjectPermission.projectType}. Operations of type ${projectOperationType} are not allowed.`
|
||||
});
|
||||
@@ -305,7 +302,7 @@ export const permissionServiceFactory = ({
|
||||
}
|
||||
|
||||
if (
|
||||
projectOperationType !== ProjectOperationType.Global &&
|
||||
projectOperationType !== ActionProjectType.Any &&
|
||||
projectOperationType !== identityProjectPermission.projectType
|
||||
) {
|
||||
throw new BadRequestError({
|
||||
@@ -387,7 +384,7 @@ export const permissionServiceFactory = ({
|
||||
});
|
||||
}
|
||||
|
||||
if (projectOperationType !== ProjectOperationType.Global && projectOperationType !== serviceTokenProject.type) {
|
||||
if (projectOperationType !== ActionProjectType.Any && projectOperationType !== serviceTokenProject.type) {
|
||||
throw new BadRequestError({
|
||||
message: `The project is of type ${serviceTokenProject.type}. Operations of type ${projectOperationType} are not allowed.`
|
||||
});
|
||||
|
||||
+8
-8
@@ -2,7 +2,7 @@ import { ForbiddenError, MongoAbility, RawRuleOf } from "@casl/ability";
|
||||
import { PackRule, packRules, unpackRules } from "@casl/ability/extra";
|
||||
import ms from "ms";
|
||||
|
||||
import { ProjectOperationType, TableName } from "@app/db/schemas";
|
||||
import { ActionProjectType, TableName } from "@app/db/schemas";
|
||||
import { isAtLeastAsPrivileged } from "@app/lib/casl";
|
||||
import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
|
||||
import { UnpackedPermissionSchema } from "@app/server/routes/santizedSchemas/permission";
|
||||
@@ -61,7 +61,7 @@ export const projectUserAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: projectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Member);
|
||||
const { permission: targetUserPermission } = await permissionService.getProjectPermission({
|
||||
@@ -70,7 +70,7 @@ export const projectUserAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: projectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
|
||||
// we need to validate that the privilege given is not higher than the assigning users permission
|
||||
@@ -148,7 +148,7 @@ export const projectUserAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: projectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Member);
|
||||
const { permission: targetUserPermission } = await permissionService.getProjectPermission({
|
||||
@@ -157,7 +157,7 @@ export const projectUserAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: projectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
|
||||
// we need to validate that the privilege given is not higher than the assigning users permission
|
||||
@@ -234,7 +234,7 @@ export const projectUserAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: projectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Member);
|
||||
|
||||
@@ -271,7 +271,7 @@ export const projectUserAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: projectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member);
|
||||
|
||||
@@ -298,7 +298,7 @@ export const projectUserAdditionalPrivilegeServiceFactory = ({
|
||||
projectId: projectMembership.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ForbiddenError } from "@casl/ability";
|
||||
import picomatch from "picomatch";
|
||||
|
||||
import { ProjectOperationType } from "@app/db/schemas";
|
||||
import { ActionProjectType } from "@app/db/schemas";
|
||||
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
|
||||
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
|
||||
import { BadRequestError, NotFoundError } from "@app/lib/errors";
|
||||
@@ -85,7 +85,7 @@ export const secretApprovalPolicyServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Create,
|
||||
@@ -199,7 +199,7 @@ export const secretApprovalPolicyServiceFactory = ({
|
||||
projectId: secretApprovalPolicy.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.SecretApproval);
|
||||
|
||||
@@ -294,7 +294,7 @@ export const secretApprovalPolicyServiceFactory = ({
|
||||
projectId: sapPolicy.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Delete,
|
||||
@@ -334,7 +334,7 @@ export const secretApprovalPolicyServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretApproval);
|
||||
|
||||
@@ -379,7 +379,7 @@ export const secretApprovalPolicyServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
|
||||
return getSecretApprovalPolicy(projectId, environment, secretPath);
|
||||
@@ -406,7 +406,7 @@ export const secretApprovalPolicyServiceFactory = ({
|
||||
projectId: sapPolicy.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretApproval);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { ForbiddenError, subject } from "@casl/ability";
|
||||
|
||||
import {
|
||||
ActionProjectType,
|
||||
ProjectMembershipRole,
|
||||
ProjectOperationType,
|
||||
SecretEncryptionAlgo,
|
||||
SecretKeyEncoding,
|
||||
SecretType,
|
||||
@@ -153,7 +153,7 @@ export const secretApprovalRequestServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
|
||||
const count = await secretApprovalRequestDAL.findProjectRequestCount(projectId, actorId);
|
||||
@@ -180,7 +180,7 @@ export const secretApprovalRequestServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
|
||||
const { shouldUseSecretV2Bridge } = await projectBotService.getBotKey(projectId);
|
||||
@@ -230,7 +230,7 @@ export const secretApprovalRequestServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
if (
|
||||
!hasRole(ProjectMembershipRole.Admin) &&
|
||||
@@ -351,7 +351,7 @@ export const secretApprovalRequestServiceFactory = ({
|
||||
projectId: secretApprovalRequest.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
if (
|
||||
!hasRole(ProjectMembershipRole.Admin) &&
|
||||
@@ -418,7 +418,7 @@ export const secretApprovalRequestServiceFactory = ({
|
||||
projectId: secretApprovalRequest.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
if (
|
||||
!hasRole(ProjectMembershipRole.Admin) &&
|
||||
@@ -475,7 +475,7 @@ export const secretApprovalRequestServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
|
||||
if (
|
||||
@@ -907,7 +907,7 @@ export const secretApprovalRequestServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Read,
|
||||
@@ -1188,7 +1188,7 @@ export const secretApprovalRequestServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath);
|
||||
if (!folder)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ForbiddenError, subject } from "@casl/ability";
|
||||
import Ajv from "ajv";
|
||||
|
||||
import { ProjectOperationType, ProjectVersion, TableName } from "@app/db/schemas";
|
||||
import { ActionProjectType, ProjectVersion, TableName } from "@app/db/schemas";
|
||||
import { decryptSymmetric128BitHexKeyUTF8, infisicalSymmetricEncypt } from "@app/lib/crypto/encryption";
|
||||
import { BadRequestError, NotFoundError } from "@app/lib/errors";
|
||||
import { TProjectPermission } from "@app/lib/types";
|
||||
@@ -59,7 +59,7 @@ export const secretRotationServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRotation);
|
||||
|
||||
@@ -88,7 +88,7 @@ export const secretRotationServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Create,
|
||||
@@ -197,7 +197,7 @@ export const secretRotationServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRotation);
|
||||
const { botKey, shouldUseSecretV2Bridge } = await projectBotService.getBotKey(projectId);
|
||||
@@ -243,7 +243,7 @@ export const secretRotationServiceFactory = ({
|
||||
projectId: project.id,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.SecretRotation);
|
||||
await secretRotationQueue.removeFromQueue(doc.id, doc.interval);
|
||||
@@ -261,7 +261,7 @@ export const secretRotationServiceFactory = ({
|
||||
projectId: doc.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Delete,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ForbiddenError, subject } from "@casl/ability";
|
||||
|
||||
import { ProjectOperationType, TableName, TSecretTagJunctionInsert, TSecretV2TagJunctionInsert } from "@app/db/schemas";
|
||||
import { ActionProjectType, TableName, TSecretTagJunctionInsert, TSecretV2TagJunctionInsert } from "@app/db/schemas";
|
||||
import { decryptSymmetric128BitHexKeyUTF8 } from "@app/lib/crypto";
|
||||
import { InternalServerError, NotFoundError } from "@app/lib/errors";
|
||||
import { groupBy } from "@app/lib/fn";
|
||||
@@ -89,7 +89,7 @@ export const secretSnapshotServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback);
|
||||
|
||||
@@ -126,7 +126,7 @@ export const secretSnapshotServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback);
|
||||
|
||||
@@ -155,7 +155,7 @@ export const secretSnapshotServiceFactory = ({
|
||||
projectId: snapshot.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback);
|
||||
@@ -331,7 +331,7 @@ export const secretSnapshotServiceFactory = ({
|
||||
projectId: snapshot.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SecretManager
|
||||
projectOperationType: ActionProjectType.SecretManager
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Create,
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import { ForbiddenError } from "@casl/ability";
|
||||
import ms from "ms";
|
||||
|
||||
import { ProjectOperationType } from "@app/db/schemas";
|
||||
import { ActionProjectType } from "@app/db/schemas";
|
||||
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
|
||||
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
|
||||
import { BadRequestError, NotFoundError } from "@app/lib/errors";
|
||||
@@ -60,7 +60,7 @@ export const sshCertificateTemplateServiceFactory = ({
|
||||
projectId: ca.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SSH
|
||||
projectOperationType: ActionProjectType.SSH
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
@@ -133,7 +133,7 @@ export const sshCertificateTemplateServiceFactory = ({
|
||||
projectId: certTemplate.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SSH
|
||||
projectOperationType: ActionProjectType.SSH
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
@@ -202,7 +202,7 @@ export const sshCertificateTemplateServiceFactory = ({
|
||||
projectId: certificateTemplate.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SSH
|
||||
projectOperationType: ActionProjectType.SSH
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
@@ -229,7 +229,7 @@ export const sshCertificateTemplateServiceFactory = ({
|
||||
projectId: certTemplate.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SSH
|
||||
projectOperationType: ActionProjectType.SSH
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ForbiddenError } from "@casl/ability";
|
||||
|
||||
import { ProjectOperationType } from "@app/db/schemas";
|
||||
import { ActionProjectType } from "@app/db/schemas";
|
||||
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
|
||||
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
|
||||
import { TSshCertificateAuthorityDALFactory } from "@app/ee/services/ssh/ssh-certificate-authority-dal";
|
||||
@@ -71,7 +71,7 @@ export const sshCertificateAuthorityServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SSH
|
||||
projectOperationType: ActionProjectType.SSH
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
@@ -124,7 +124,7 @@ export const sshCertificateAuthorityServiceFactory = ({
|
||||
projectId: ca.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SSH
|
||||
projectOperationType: ActionProjectType.SSH
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
@@ -193,7 +193,7 @@ export const sshCertificateAuthorityServiceFactory = ({
|
||||
projectId: ca.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SSH
|
||||
projectOperationType: ActionProjectType.SSH
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
@@ -232,7 +232,7 @@ export const sshCertificateAuthorityServiceFactory = ({
|
||||
projectId: ca.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SSH
|
||||
projectOperationType: ActionProjectType.SSH
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
@@ -274,7 +274,7 @@ export const sshCertificateAuthorityServiceFactory = ({
|
||||
projectId: sshCertificateTemplate.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SSH
|
||||
projectOperationType: ActionProjectType.SSH
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
@@ -396,7 +396,7 @@ export const sshCertificateAuthorityServiceFactory = ({
|
||||
projectId: sshCertificateTemplate.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SSH
|
||||
projectOperationType: ActionProjectType.SSH
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
@@ -494,7 +494,7 @@ export const sshCertificateAuthorityServiceFactory = ({
|
||||
projectId: ca.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.SSH
|
||||
projectOperationType: ActionProjectType.SSH
|
||||
});
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ForbiddenError } from "@casl/ability";
|
||||
|
||||
import { ProjectOperationType } from "@app/db/schemas";
|
||||
import { ActionProjectType } from "@app/db/schemas";
|
||||
import { BadRequestError } from "@app/lib/errors";
|
||||
import { extractIPDetails, isValidIpOrCidr } from "@app/lib/ip";
|
||||
import { TProjectPermission } from "@app/lib/types";
|
||||
@@ -34,7 +34,7 @@ export const trustedIpServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.IpAllowList);
|
||||
const trustedIps = await trustedIpDAL.find({
|
||||
@@ -59,7 +59,7 @@ export const trustedIpServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.IpAllowList);
|
||||
|
||||
@@ -105,7 +105,7 @@ export const trustedIpServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.IpAllowList);
|
||||
|
||||
@@ -151,7 +151,7 @@ export const trustedIpServiceFactory = ({
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
projectOperationType: ProjectOperationType.Global
|
||||
projectOperationType: ActionProjectType.Any
|
||||
});
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.IpAllowList);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user