feat: updated all permission argument to actionProjectType

This commit is contained in:
=
2025-01-14 23:41:06 +05:30
parent 6f38d6c76f
commit 3a5bb31bde
45 changed files with 310 additions and 313 deletions
@@ -93,7 +93,7 @@ export const accessApprovalPolicyServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -199,7 +199,7 @@ export const accessApprovalPolicyServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const accessApprovalPolicies = await accessApprovalPolicyDAL.find({ projectId: project.id, deletedAt: null }); const accessApprovalPolicies = await accessApprovalPolicyDAL.find({ projectId: project.id, deletedAt: null });
@@ -250,7 +250,7 @@ export const accessApprovalPolicyServiceFactory = ({
projectId: accessApprovalPolicy.projectId, projectId: accessApprovalPolicy.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.SecretApproval); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.SecretApproval);
@@ -334,7 +334,7 @@ export const accessApprovalPolicyServiceFactory = ({
projectId: policy.projectId, projectId: policy.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Delete, ProjectPermissionActions.Delete,
@@ -385,7 +385,7 @@ export const accessApprovalPolicyServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if (!membership) { if (!membership) {
throw new ForbiddenRequestError({ message: "You are not a member of this project" }); throw new ForbiddenRequestError({ message: "You are not a member of this project" });
@@ -425,7 +425,7 @@ export const accessApprovalPolicyServiceFactory = ({
projectId: policy.projectId, projectId: policy.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretApproval); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretApproval);
@@ -106,7 +106,7 @@ export const accessApprovalRequestServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if (!membership) { if (!membership) {
throw new ForbiddenRequestError({ message: "You are not a member of this project" }); throw new ForbiddenRequestError({ message: "You are not a member of this project" });
@@ -280,7 +280,7 @@ export const accessApprovalRequestServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if (!membership) { if (!membership) {
throw new ForbiddenRequestError({ message: "You are not a member of this project" }); throw new ForbiddenRequestError({ message: "You are not a member of this project" });
@@ -326,7 +326,7 @@ export const accessApprovalRequestServiceFactory = ({
projectId: accessApprovalRequest.projectId, projectId: accessApprovalRequest.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if (!membership) { if (!membership) {
@@ -431,7 +431,7 @@ export const accessApprovalRequestServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if (!membership) { if (!membership) {
throw new ForbiddenRequestError({ message: "You are not a member of this project" }); throw new ForbiddenRequestError({ message: "You are not a member of this project" });
@@ -33,7 +33,7 @@ export const auditLogServiceFactory = ({
projectId: filter.projectId, projectId: filter.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.AuditLogs); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.AuditLogs);
} else { } else {
@@ -73,7 +73,7 @@ export const certificateAuthorityCrlServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -73,7 +73,7 @@ export const dynamicSecretLeaseServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionDynamicSecretActions.Lease, ProjectPermissionDynamicSecretActions.Lease,
@@ -153,7 +153,7 @@ export const dynamicSecretLeaseServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionDynamicSecretActions.Lease, ProjectPermissionDynamicSecretActions.Lease,
@@ -233,7 +233,7 @@ export const dynamicSecretLeaseServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionDynamicSecretActions.Lease, ProjectPermissionDynamicSecretActions.Lease,
@@ -303,7 +303,7 @@ export const dynamicSecretLeaseServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionDynamicSecretActions.Lease, ProjectPermissionDynamicSecretActions.Lease,
@@ -346,7 +346,7 @@ export const dynamicSecretLeaseServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionDynamicSecretActions.Lease, ProjectPermissionDynamicSecretActions.Lease,
@@ -79,7 +79,7 @@ export const dynamicSecretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionDynamicSecretActions.CreateRootCredential, ProjectPermissionDynamicSecretActions.CreateRootCredential,
@@ -151,7 +151,7 @@ export const dynamicSecretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionDynamicSecretActions.EditRootCredential, ProjectPermissionDynamicSecretActions.EditRootCredential,
@@ -235,7 +235,7 @@ export const dynamicSecretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionDynamicSecretActions.DeleteRootCredential, ProjectPermissionDynamicSecretActions.DeleteRootCredential,
@@ -296,7 +296,7 @@ export const dynamicSecretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionDynamicSecretActions.ReadRootCredential, ProjectPermissionDynamicSecretActions.ReadRootCredential,
@@ -347,7 +347,7 @@ export const dynamicSecretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
// verify user has access to each env in request // verify user has access to each env in request
@@ -391,7 +391,7 @@ export const dynamicSecretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionDynamicSecretActions.ReadRootCredential, ProjectPermissionDynamicSecretActions.ReadRootCredential,
@@ -440,7 +440,7 @@ export const dynamicSecretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionDynamicSecretActions.ReadRootCredential, ProjectPermissionDynamicSecretActions.ReadRootCredential,
@@ -472,7 +472,7 @@ export const dynamicSecretServiceFactory = ({
projectId, projectId,
actorAuthMethod: actor.authMethod, actorAuthMethod: actor.authMethod,
actorOrgId: actor.orgId, actorOrgId: actor.orgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const userAccessibleFolderMappings = folderMappings.filter(({ path, environment }) => const userAccessibleFolderMappings = folderMappings.filter(({ path, environment }) =>
@@ -518,7 +518,7 @@ export const dynamicSecretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
// verify user has access to each env in request // verify user has access to each env in request
@@ -61,7 +61,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
projectId: identityProjectMembership.projectId, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Edit, ProjectPermissionActions.Edit,
@@ -73,7 +73,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
projectId: identityProjectMembership.projectId, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
// we need to validate that the privilege given is not higher than the assigning users permission // 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, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Edit, ProjectPermissionActions.Edit,
@@ -155,7 +155,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
projectId: identityProjectMembership.projectId, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
// we need to validate that the privilege given is not higher than the assigning users permission // 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, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Edit, ProjectPermissionActions.Edit,
@@ -237,7 +237,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
projectId: identityProjectMembership.projectId, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
const hasRequiredPriviledges = isAtLeastAsPrivileged(permission, identityRolePermission); const hasRequiredPriviledges = isAtLeastAsPrivileged(permission, identityRolePermission);
if (!hasRequiredPriviledges) if (!hasRequiredPriviledges)
@@ -272,7 +272,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
projectId: identityProjectMembership.projectId, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Read, ProjectPermissionActions.Read,
@@ -307,7 +307,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
projectId: identityProjectMembership.projectId, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Read, ProjectPermissionActions.Read,
@@ -343,7 +343,7 @@ export const identityProjectAdditionalPrivilegeV2ServiceFactory = ({
projectId: identityProjectMembership.projectId, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Read, ProjectPermissionActions.Read,
@@ -69,7 +69,7 @@ export const identityProjectAdditionalPrivilegeServiceFactory = ({
projectId: identityProjectMembership.projectId, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Edit, ProjectPermissionActions.Edit,
@@ -82,7 +82,7 @@ export const identityProjectAdditionalPrivilegeServiceFactory = ({
projectId: identityProjectMembership.projectId, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
// we need to validate that the privilege given is not higher than the assigning users permission // 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, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -166,7 +166,7 @@ export const identityProjectAdditionalPrivilegeServiceFactory = ({
projectId: identityProjectMembership.projectId, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
// we need to validate that the privilege given is not higher than the assigning users permission // 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, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Edit, ProjectPermissionActions.Edit,
@@ -266,7 +266,7 @@ export const identityProjectAdditionalPrivilegeServiceFactory = ({
projectId: identityProjectMembership.projectId, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
const hasRequiredPriviledges = isAtLeastAsPrivileged(permission, identityRolePermission); const hasRequiredPriviledges = isAtLeastAsPrivileged(permission, identityRolePermission);
if (!hasRequiredPriviledges) if (!hasRequiredPriviledges)
@@ -312,7 +312,7 @@ export const identityProjectAdditionalPrivilegeServiceFactory = ({
projectId: identityProjectMembership.projectId, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Read, ProjectPermissionActions.Read,
@@ -355,7 +355,7 @@ export const identityProjectAdditionalPrivilegeServiceFactory = ({
projectId: identityProjectMembership.projectId, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -15,7 +15,7 @@ export type TGetUserProjectPermissionArg = {
userId: string; userId: string;
projectId: string; projectId: string;
authMethod: ActorAuthMethod; authMethod: ActorAuthMethod;
projectOperationType: ActionProjectType; actionProjectType: ActionProjectType;
userOrgId?: string; userOrgId?: string;
}; };
@@ -23,14 +23,14 @@ export type TGetIdentityProjectPermissionArg = {
identityId: string; identityId: string;
projectId: string; projectId: string;
identityOrgId?: string; identityOrgId?: string;
projectOperationType: ActionProjectType; actionProjectType: ActionProjectType;
}; };
export type TGetServiceTokenProjectPermissionArg = { export type TGetServiceTokenProjectPermissionArg = {
serviceTokenId: string; serviceTokenId: string;
projectId: string; projectId: string;
actorOrgId?: string; actorOrgId?: string;
projectOperationType: ActionProjectType; actionProjectType: ActionProjectType;
}; };
export type TGetProjectPermissionArg = { export type TGetProjectPermissionArg = {
@@ -39,5 +39,5 @@ export type TGetProjectPermissionArg = {
projectId: string; projectId: string;
actorAuthMethod: ActorAuthMethod; actorAuthMethod: ActorAuthMethod;
actorOrgId?: string; actorOrgId?: string;
projectOperationType: ActionProjectType; actionProjectType: ActionProjectType;
}; };
@@ -205,7 +205,7 @@ export const permissionServiceFactory = ({
projectId, projectId,
authMethod, authMethod,
userOrgId, userOrgId,
projectOperationType actionProjectType
}: TGetUserProjectPermissionArg): Promise<TProjectPermissionRT<ActorType.USER>> => { }: TGetUserProjectPermissionArg): Promise<TProjectPermissionRT<ActorType.USER>> => {
const userProjectPermission = await permissionDAL.getProjectPermission(userId, projectId); const userProjectPermission = await permissionDAL.getProjectPermission(userId, projectId);
if (!userProjectPermission) throw new ForbiddenRequestError({ name: "User not a part of the specified project" }); if (!userProjectPermission) throw new ForbiddenRequestError({ name: "User not a part of the specified project" });
@@ -227,9 +227,9 @@ export const permissionServiceFactory = ({
validateOrgSSO(authMethod, userProjectPermission.orgAuthEnforced); validateOrgSSO(authMethod, userProjectPermission.orgAuthEnforced);
if (projectOperationType !== ActionProjectType.Any && projectOperationType !== userProjectPermission.projectType) { if (actionProjectType !== ActionProjectType.Any && actionProjectType !== userProjectPermission.projectType) {
throw new BadRequestError({ throw new BadRequestError({
message: `The project is of type ${userProjectPermission.projectType}. Operations of type ${projectOperationType} are not allowed.` message: `The project is of type ${userProjectPermission.projectType}. Operations of type ${actionProjectType} are not allowed.`
}); });
} }
@@ -281,7 +281,7 @@ export const permissionServiceFactory = ({
identityId, identityId,
projectId, projectId,
identityOrgId, identityOrgId,
projectOperationType actionProjectType
}: TGetIdentityProjectPermissionArg): Promise<TProjectPermissionRT<ActorType.IDENTITY>> => { }: TGetIdentityProjectPermissionArg): Promise<TProjectPermissionRT<ActorType.IDENTITY>> => {
const identityProjectPermission = await permissionDAL.getProjectIdentityPermission(identityId, projectId); const identityProjectPermission = await permissionDAL.getProjectIdentityPermission(identityId, projectId);
if (!identityProjectPermission) if (!identityProjectPermission)
@@ -301,12 +301,9 @@ export const permissionServiceFactory = ({
throw new ForbiddenRequestError({ name: "Identity is not a member of the specified organization" }); throw new ForbiddenRequestError({ name: "Identity is not a member of the specified organization" });
} }
if ( if (actionProjectType !== ActionProjectType.Any && actionProjectType !== identityProjectPermission.projectType) {
projectOperationType !== ActionProjectType.Any &&
projectOperationType !== identityProjectPermission.projectType
) {
throw new BadRequestError({ throw new BadRequestError({
message: `The project is of type ${identityProjectPermission.projectType}. Operations of type ${projectOperationType} are not allowed.` message: `The project is of type ${identityProjectPermission.projectType}. Operations of type ${actionProjectType} are not allowed.`
}); });
} }
@@ -359,7 +356,7 @@ export const permissionServiceFactory = ({
serviceTokenId, serviceTokenId,
projectId, projectId,
actorOrgId, actorOrgId,
projectOperationType actionProjectType
}: TGetServiceTokenProjectPermissionArg) => { }: TGetServiceTokenProjectPermissionArg) => {
const serviceToken = await serviceTokenDAL.findById(serviceTokenId); const serviceToken = await serviceTokenDAL.findById(serviceTokenId);
if (!serviceToken) throw new NotFoundError({ message: `Service token with ID '${serviceTokenId}' not found` }); if (!serviceToken) throw new NotFoundError({ message: `Service token with ID '${serviceTokenId}' not found` });
@@ -384,9 +381,9 @@ export const permissionServiceFactory = ({
}); });
} }
if (projectOperationType !== ActionProjectType.Any && projectOperationType !== serviceTokenProject.type) { if (actionProjectType !== ActionProjectType.Any && actionProjectType !== serviceTokenProject.type) {
throw new BadRequestError({ throw new BadRequestError({
message: `The project is of type ${serviceTokenProject.type}. Operations of type ${projectOperationType} are not allowed.` message: `The project is of type ${serviceTokenProject.type}. Operations of type ${actionProjectType} are not allowed.`
}); });
} }
@@ -536,7 +533,7 @@ export const permissionServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType actionProjectType
}: TGetProjectPermissionArg): Promise<TProjectPermissionRT<T>> => { }: TGetProjectPermissionArg): Promise<TProjectPermissionRT<T>> => {
switch (actor) { switch (actor) {
case ActorType.USER: case ActorType.USER:
@@ -545,21 +542,21 @@ export const permissionServiceFactory = ({
projectId, projectId,
authMethod: actorAuthMethod, authMethod: actorAuthMethod,
userOrgId: actorOrgId, userOrgId: actorOrgId,
projectOperationType actionProjectType
}) as Promise<TProjectPermissionRT<T>>; }) as Promise<TProjectPermissionRT<T>>;
case ActorType.SERVICE: case ActorType.SERVICE:
return getServiceTokenProjectPermission({ return getServiceTokenProjectPermission({
serviceTokenId: actorId, serviceTokenId: actorId,
projectId, projectId,
actorOrgId, actorOrgId,
projectOperationType actionProjectType
}) as Promise<TProjectPermissionRT<T>>; }) as Promise<TProjectPermissionRT<T>>;
case ActorType.IDENTITY: case ActorType.IDENTITY:
return getIdentityProjectPermission({ return getIdentityProjectPermission({
identityId: actorId, identityId: actorId,
projectId, projectId,
identityOrgId: actorOrgId, identityOrgId: actorOrgId,
projectOperationType actionProjectType
}) as Promise<TProjectPermissionRT<T>>; }) as Promise<TProjectPermissionRT<T>>;
default: default:
throw new BadRequestError({ throw new BadRequestError({
@@ -61,7 +61,7 @@ export const projectUserAdditionalPrivilegeServiceFactory = ({
projectId: projectMembership.projectId, projectId: projectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Member); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Member);
const { permission: targetUserPermission } = await permissionService.getProjectPermission({ const { permission: targetUserPermission } = await permissionService.getProjectPermission({
@@ -70,7 +70,7 @@ export const projectUserAdditionalPrivilegeServiceFactory = ({
projectId: projectMembership.projectId, projectId: projectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
// we need to validate that the privilege given is not higher than the assigning users permission // 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, projectId: projectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Member); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Member);
const { permission: targetUserPermission } = await permissionService.getProjectPermission({ const { permission: targetUserPermission } = await permissionService.getProjectPermission({
@@ -157,7 +157,7 @@ export const projectUserAdditionalPrivilegeServiceFactory = ({
projectId: projectMembership.projectId, projectId: projectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
// we need to validate that the privilege given is not higher than the assigning users permission // 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, projectId: projectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Member); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Member);
@@ -271,7 +271,7 @@ export const projectUserAdditionalPrivilegeServiceFactory = ({
projectId: projectMembership.projectId, projectId: projectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member);
@@ -298,7 +298,7 @@ export const projectUserAdditionalPrivilegeServiceFactory = ({
projectId: projectMembership.projectId, projectId: projectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member);
@@ -85,7 +85,7 @@ export const secretApprovalPolicyServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Create, ProjectPermissionActions.Create,
@@ -199,7 +199,7 @@ export const secretApprovalPolicyServiceFactory = ({
projectId: secretApprovalPolicy.projectId, projectId: secretApprovalPolicy.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.SecretApproval); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.SecretApproval);
@@ -294,7 +294,7 @@ export const secretApprovalPolicyServiceFactory = ({
projectId: sapPolicy.projectId, projectId: sapPolicy.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Delete, ProjectPermissionActions.Delete,
@@ -334,7 +334,7 @@ export const secretApprovalPolicyServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretApproval); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretApproval);
@@ -379,7 +379,7 @@ export const secretApprovalPolicyServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
return getSecretApprovalPolicy(projectId, environment, secretPath); return getSecretApprovalPolicy(projectId, environment, secretPath);
@@ -406,7 +406,7 @@ export const secretApprovalPolicyServiceFactory = ({
projectId: sapPolicy.projectId, projectId: sapPolicy.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretApproval); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretApproval);
@@ -153,7 +153,7 @@ export const secretApprovalRequestServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const count = await secretApprovalRequestDAL.findProjectRequestCount(projectId, actorId); const count = await secretApprovalRequestDAL.findProjectRequestCount(projectId, actorId);
@@ -180,7 +180,7 @@ export const secretApprovalRequestServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const { shouldUseSecretV2Bridge } = await projectBotService.getBotKey(projectId); const { shouldUseSecretV2Bridge } = await projectBotService.getBotKey(projectId);
@@ -230,7 +230,7 @@ export const secretApprovalRequestServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if ( if (
!hasRole(ProjectMembershipRole.Admin) && !hasRole(ProjectMembershipRole.Admin) &&
@@ -351,7 +351,7 @@ export const secretApprovalRequestServiceFactory = ({
projectId: secretApprovalRequest.projectId, projectId: secretApprovalRequest.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if ( if (
!hasRole(ProjectMembershipRole.Admin) && !hasRole(ProjectMembershipRole.Admin) &&
@@ -418,7 +418,7 @@ export const secretApprovalRequestServiceFactory = ({
projectId: secretApprovalRequest.projectId, projectId: secretApprovalRequest.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if ( if (
!hasRole(ProjectMembershipRole.Admin) && !hasRole(ProjectMembershipRole.Admin) &&
@@ -475,7 +475,7 @@ export const secretApprovalRequestServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if ( if (
@@ -907,7 +907,7 @@ export const secretApprovalRequestServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Read, ProjectPermissionActions.Read,
@@ -1188,7 +1188,7 @@ export const secretApprovalRequestServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath); const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath);
if (!folder) if (!folder)
@@ -59,7 +59,7 @@ export const secretRotationServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRotation); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRotation);
@@ -88,7 +88,7 @@ export const secretRotationServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Create, ProjectPermissionActions.Create,
@@ -197,7 +197,7 @@ export const secretRotationServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRotation); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRotation);
const { botKey, shouldUseSecretV2Bridge } = await projectBotService.getBotKey(projectId); const { botKey, shouldUseSecretV2Bridge } = await projectBotService.getBotKey(projectId);
@@ -243,7 +243,7 @@ export const secretRotationServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.SecretRotation); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.SecretRotation);
await secretRotationQueue.removeFromQueue(doc.id, doc.interval); await secretRotationQueue.removeFromQueue(doc.id, doc.interval);
@@ -261,7 +261,7 @@ export const secretRotationServiceFactory = ({
projectId: doc.projectId, projectId: doc.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Delete, ProjectPermissionActions.Delete,
@@ -89,7 +89,7 @@ export const secretSnapshotServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback);
@@ -126,7 +126,7 @@ export const secretSnapshotServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback);
@@ -155,7 +155,7 @@ export const secretSnapshotServiceFactory = ({
projectId: snapshot.projectId, projectId: snapshot.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback);
@@ -331,7 +331,7 @@ export const secretSnapshotServiceFactory = ({
projectId: snapshot.projectId, projectId: snapshot.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Create, ProjectPermissionActions.Create,
@@ -60,7 +60,7 @@ export const sshCertificateTemplateServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SSH actionProjectType: ActionProjectType.SSH
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -133,7 +133,7 @@ export const sshCertificateTemplateServiceFactory = ({
projectId: certTemplate.projectId, projectId: certTemplate.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SSH actionProjectType: ActionProjectType.SSH
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -202,7 +202,7 @@ export const sshCertificateTemplateServiceFactory = ({
projectId: certificateTemplate.projectId, projectId: certificateTemplate.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SSH actionProjectType: ActionProjectType.SSH
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -229,7 +229,7 @@ export const sshCertificateTemplateServiceFactory = ({
projectId: certTemplate.projectId, projectId: certTemplate.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SSH actionProjectType: ActionProjectType.SSH
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -71,7 +71,7 @@ export const sshCertificateAuthorityServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SSH actionProjectType: ActionProjectType.SSH
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -124,7 +124,7 @@ export const sshCertificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SSH actionProjectType: ActionProjectType.SSH
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -193,7 +193,7 @@ export const sshCertificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SSH actionProjectType: ActionProjectType.SSH
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -232,7 +232,7 @@ export const sshCertificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SSH actionProjectType: ActionProjectType.SSH
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -274,7 +274,7 @@ export const sshCertificateAuthorityServiceFactory = ({
projectId: sshCertificateTemplate.projectId, projectId: sshCertificateTemplate.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SSH actionProjectType: ActionProjectType.SSH
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -396,7 +396,7 @@ export const sshCertificateAuthorityServiceFactory = ({
projectId: sshCertificateTemplate.projectId, projectId: sshCertificateTemplate.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SSH actionProjectType: ActionProjectType.SSH
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -494,7 +494,7 @@ export const sshCertificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SSH actionProjectType: ActionProjectType.SSH
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -34,7 +34,7 @@ export const trustedIpServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.IpAllowList); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.IpAllowList);
const trustedIps = await trustedIpDAL.find({ const trustedIps = await trustedIpDAL.find({
@@ -59,7 +59,7 @@ export const trustedIpServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.IpAllowList); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.IpAllowList);
@@ -105,7 +105,7 @@ export const trustedIpServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.IpAllowList); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.IpAllowList);
@@ -151,7 +151,7 @@ export const trustedIpServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.IpAllowList); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.IpAllowList);
@@ -226,7 +226,7 @@ export const registerDashboardRouter = async (server: FastifyZodProvider) => {
projectId, projectId,
actorAuthMethod: req.permission.authMethod, actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId, actorOrgId: req.permission.orgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const allowedDynamicSecretEnvironments = // filter envs user has access to const allowedDynamicSecretEnvironments = // filter envs user has access to
@@ -142,7 +142,7 @@ export const certificateAuthorityServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -311,7 +311,7 @@ export const certificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Read, ProjectPermissionActions.Read,
@@ -343,7 +343,7 @@ export const certificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -369,7 +369,7 @@ export const certificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -395,7 +395,7 @@ export const certificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -457,7 +457,7 @@ export const certificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -728,7 +728,7 @@ export const certificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -764,7 +764,7 @@ export const certificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -845,7 +845,7 @@ export const certificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -992,7 +992,7 @@ export const certificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -1155,7 +1155,7 @@ export const certificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Certificates); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Certificates);
@@ -1484,7 +1484,7 @@ export const certificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod: dto.actorAuthMethod, actorAuthMethod: dto.actorAuthMethod,
actorOrgId: dto.actorOrgId, actorOrgId: dto.actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -1842,7 +1842,7 @@ export const certificateAuthorityServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -73,7 +73,7 @@ export const certificateTemplateServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -135,7 +135,7 @@ export const certificateTemplateServiceFactory = ({
projectId: certTemplate.projectId, projectId: certTemplate.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -193,7 +193,7 @@ export const certificateTemplateServiceFactory = ({
projectId: certTemplate.projectId, projectId: certTemplate.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -220,7 +220,7 @@ export const certificateTemplateServiceFactory = ({
projectId: certTemplate.projectId, projectId: certTemplate.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -262,7 +262,7 @@ export const certificateTemplateServiceFactory = ({
projectId: certTemplate.projectId, projectId: certTemplate.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -347,7 +347,7 @@ export const certificateTemplateServiceFactory = ({
projectId: certTemplate.projectId, projectId: certTemplate.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -429,7 +429,7 @@ export const certificateTemplateServiceFactory = ({
projectId: certTemplate.projectId, projectId: certTemplate.projectId,
actorAuthMethod: dto.actorAuthMethod, actorAuthMethod: dto.actorAuthMethod,
actorOrgId: dto.actorOrgId, actorOrgId: dto.actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -56,7 +56,7 @@ export const certificateServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Certificates); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Certificates);
@@ -80,7 +80,7 @@ export const certificateServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Certificates); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Certificates);
@@ -115,7 +115,7 @@ export const certificateServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Certificates); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Certificates);
@@ -162,7 +162,7 @@ export const certificateServiceFactory = ({
projectId: ca.projectId, projectId: ca.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Certificates); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Certificates);
+6 -6
View File
@@ -40,7 +40,7 @@ export const cmekServiceFactory = ({ kmsService, kmsDAL, permissionService, proj
projectId, projectId,
actorAuthMethod: actor.authMethod, actorAuthMethod: actor.authMethod,
actorOrgId: actor.orgId, actorOrgId: actor.orgId,
projectOperationType: ActionProjectType.KMS actionProjectType: ActionProjectType.KMS
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionCmekActions.Create, ProjectPermissionSub.Cmek); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionCmekActions.Create, ProjectPermissionSub.Cmek);
@@ -66,7 +66,7 @@ export const cmekServiceFactory = ({ kmsService, kmsDAL, permissionService, proj
projectId: key.projectId, projectId: key.projectId,
actorAuthMethod: actor.authMethod, actorAuthMethod: actor.authMethod,
actorOrgId: actor.orgId, actorOrgId: actor.orgId,
projectOperationType: ActionProjectType.KMS actionProjectType: ActionProjectType.KMS
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionCmekActions.Edit, ProjectPermissionSub.Cmek); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionCmekActions.Edit, ProjectPermissionSub.Cmek);
@@ -89,7 +89,7 @@ export const cmekServiceFactory = ({ kmsService, kmsDAL, permissionService, proj
projectId: key.projectId, projectId: key.projectId,
actorAuthMethod: actor.authMethod, actorAuthMethod: actor.authMethod,
actorOrgId: actor.orgId, actorOrgId: actor.orgId,
projectOperationType: ActionProjectType.KMS actionProjectType: ActionProjectType.KMS
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionCmekActions.Delete, ProjectPermissionSub.Cmek); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionCmekActions.Delete, ProjectPermissionSub.Cmek);
@@ -115,7 +115,7 @@ export const cmekServiceFactory = ({ kmsService, kmsDAL, permissionService, proj
projectId, projectId,
actorAuthMethod: actor.authMethod, actorAuthMethod: actor.authMethod,
actorOrgId: actor.orgId, actorOrgId: actor.orgId,
projectOperationType: ActionProjectType.KMS actionProjectType: ActionProjectType.KMS
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionCmekActions.Read, ProjectPermissionSub.Cmek); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionCmekActions.Read, ProjectPermissionSub.Cmek);
@@ -140,7 +140,7 @@ export const cmekServiceFactory = ({ kmsService, kmsDAL, permissionService, proj
projectId: key.projectId, projectId: key.projectId,
actorAuthMethod: actor.authMethod, actorAuthMethod: actor.authMethod,
actorOrgId: actor.orgId, actorOrgId: actor.orgId,
projectOperationType: ActionProjectType.KMS actionProjectType: ActionProjectType.KMS
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionCmekActions.Encrypt, ProjectPermissionSub.Cmek); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionCmekActions.Encrypt, ProjectPermissionSub.Cmek);
@@ -167,7 +167,7 @@ export const cmekServiceFactory = ({ kmsService, kmsDAL, permissionService, proj
projectId: key.projectId, projectId: key.projectId,
actorAuthMethod: actor.authMethod, actorAuthMethod: actor.authMethod,
actorOrgId: actor.orgId, actorOrgId: actor.orgId,
projectOperationType: ActionProjectType.KMS actionProjectType: ActionProjectType.KMS
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionCmekActions.Decrypt, ProjectPermissionSub.Cmek); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionCmekActions.Decrypt, ProjectPermissionSub.Cmek);
@@ -75,7 +75,7 @@ export const groupProjectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Groups); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Groups);
@@ -244,7 +244,7 @@ export const groupProjectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Groups); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Groups);
@@ -347,7 +347,7 @@ export const groupProjectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Groups); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Groups);
@@ -392,7 +392,7 @@ export const groupProjectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Groups); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Groups);
@@ -420,7 +420,7 @@ export const groupProjectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Groups); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Groups);
@@ -60,7 +60,7 @@ export const identityProjectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Create, ProjectPermissionActions.Create,
@@ -166,7 +166,7 @@ export const identityProjectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Edit, ProjectPermissionActions.Edit,
@@ -262,7 +262,7 @@ export const identityProjectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Delete, ProjectPermissionActions.Delete,
@@ -275,7 +275,7 @@ export const identityProjectServiceFactory = ({
projectId: identityProjectMembership.projectId, projectId: identityProjectMembership.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
if (!isAtLeastAsPrivileged(permission, identityRolePermission)) if (!isAtLeastAsPrivileged(permission, identityRolePermission))
throw new ForbiddenRequestError({ message: "Failed to delete more privileged identity" }); throw new ForbiddenRequestError({ message: "Failed to delete more privileged identity" });
@@ -302,7 +302,7 @@ export const identityProjectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Identity); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Identity);
@@ -333,7 +333,7 @@ export const identityProjectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -103,7 +103,7 @@ export const integrationAuthServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const authorizations = await integrationAuthDAL.find({ projectId }); const authorizations = await integrationAuthDAL.find({ projectId });
@@ -121,7 +121,7 @@ export const integrationAuthServiceFactory = ({
projectId: auth.projectId, projectId: auth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
return permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); return permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
@@ -139,7 +139,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
return integrationAuth; return integrationAuth;
@@ -165,7 +165,7 @@ export const integrationAuthServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Integrations);
@@ -275,7 +275,7 @@ export const integrationAuthServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Integrations);
@@ -410,7 +410,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Integrations);
@@ -672,7 +672,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
@@ -707,7 +707,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
@@ -738,7 +738,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -780,7 +780,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -809,7 +809,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -884,7 +884,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -932,7 +932,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -967,7 +967,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1026,7 +1026,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1063,7 +1063,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1105,7 +1105,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1146,7 +1146,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1187,7 +1187,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1227,7 +1227,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1268,7 +1268,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1337,7 +1337,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1412,7 +1412,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1463,7 +1463,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1512,7 +1512,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1581,7 +1581,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1623,7 +1623,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1736,7 +1736,7 @@ export const integrationAuthServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Integrations);
@@ -1760,7 +1760,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Integrations);
@@ -1794,7 +1794,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(sourcePermission).throwUnlessCan( ForbiddenError.from(sourcePermission).throwUnlessCan(
@@ -1808,7 +1808,7 @@ export const integrationAuthServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(targetPermission).throwUnlessCan( ForbiddenError.from(targetPermission).throwUnlessCan(
@@ -1841,7 +1841,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -1882,7 +1882,7 @@ export const integrationAuthServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId); const { shouldUseSecretV2Bridge, botKey } = await projectBotService.getBotKey(integrationAuth.projectId);
@@ -87,7 +87,7 @@ export const integrationServiceFactory = ({
projectId: integrationAuth.projectId, projectId: integrationAuth.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Integrations);
@@ -166,7 +166,7 @@ export const integrationServiceFactory = ({
projectId: integration.projectId, projectId: integration.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Integrations);
@@ -233,7 +233,7 @@ export const integrationServiceFactory = ({
projectId: integration.projectId, projectId: integration.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
@@ -261,7 +261,7 @@ export const integrationServiceFactory = ({
projectId: integration.projectId, projectId: integration.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
@@ -304,7 +304,7 @@ export const integrationServiceFactory = ({
projectId: integration.projectId, projectId: integration.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Integrations);
@@ -341,7 +341,7 @@ export const integrationServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
@@ -361,7 +361,7 @@ export const integrationServiceFactory = ({
projectId: integration.projectId, projectId: integration.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
+1 -1
View File
@@ -780,7 +780,7 @@ export const orgServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(projectPermission).throwUnlessCan( ForbiddenError.from(projectPermission).throwUnlessCan(
ProjectPermissionActions.Create, ProjectPermissionActions.Create,
@@ -92,7 +92,7 @@ export const pkiAlertServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.PkiAlerts); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.PkiAlerts);
@@ -122,7 +122,7 @@ export const pkiAlertServiceFactory = ({
projectId: alert.projectId, projectId: alert.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.PkiAlerts); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.PkiAlerts);
@@ -149,7 +149,7 @@ export const pkiAlertServiceFactory = ({
projectId: alert.projectId, projectId: alert.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.PkiAlerts); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.PkiAlerts);
@@ -182,7 +182,7 @@ export const pkiAlertServiceFactory = ({
projectId: alert.projectId, projectId: alert.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.PkiAlerts); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.PkiAlerts);
@@ -68,7 +68,7 @@ export const pkiCollectionServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -101,7 +101,7 @@ export const pkiCollectionServiceFactory = ({
projectId: pkiCollection.projectId, projectId: pkiCollection.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.PkiCollections); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.PkiCollections);
@@ -126,7 +126,7 @@ export const pkiCollectionServiceFactory = ({
projectId: pkiCollection.projectId, projectId: pkiCollection.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.PkiCollections); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.PkiCollections);
@@ -154,7 +154,7 @@ export const pkiCollectionServiceFactory = ({
projectId: pkiCollection.projectId, projectId: pkiCollection.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -184,7 +184,7 @@ export const pkiCollectionServiceFactory = ({
projectId: pkiCollection.projectId, projectId: pkiCollection.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.PkiCollections); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.PkiCollections);
@@ -228,7 +228,7 @@ export const pkiCollectionServiceFactory = ({
projectId: pkiCollection.projectId, projectId: pkiCollection.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -322,7 +322,7 @@ export const pkiCollectionServiceFactory = ({
projectId: pkiCollection.projectId, projectId: pkiCollection.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -47,7 +47,7 @@ export const projectBotServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
@@ -114,7 +114,7 @@ export const projectBotServiceFactory = ({
projectId: bot.projectId, projectId: bot.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Integrations); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Integrations);
@@ -48,7 +48,7 @@ export const projectEnvServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Environments); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Environments);
@@ -137,7 +137,7 @@ export const projectEnvServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Environments); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Environments);
@@ -201,7 +201,7 @@ export const projectEnvServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Environments); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Environments);
@@ -257,7 +257,7 @@ export const projectEnvServiceFactory = ({
projectId: environment.projectId, projectId: environment.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Environments); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Environments);
@@ -38,7 +38,7 @@ export const projectKeyServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Member); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Member);
@@ -68,7 +68,7 @@ export const projectKeyServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
const latestKey = await projectKeyDAL.findLatestProjectKey(actorId, projectId); const latestKey = await projectKeyDAL.findLatestProjectKey(actorId, projectId);
return latestKey; return latestKey;
@@ -87,7 +87,7 @@ export const projectKeyServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member);
return projectKeyDAL.findAllProjectUserPubKeys(projectId); return projectKeyDAL.findAllProjectUserPubKeys(projectId);
@@ -84,7 +84,7 @@ export const projectMembershipServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member);
@@ -128,7 +128,7 @@ export const projectMembershipServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member);
@@ -151,7 +151,7 @@ export const projectMembershipServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member);
@@ -178,7 +178,7 @@ export const projectMembershipServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Member); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Member);
const orgMembers = await orgDAL.findMembership({ const orgMembers = await orgDAL.findMembership({
@@ -259,7 +259,7 @@ export const projectMembershipServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Member); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Member);
@@ -359,7 +359,7 @@ export const projectMembershipServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Member); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Member);
@@ -395,7 +395,7 @@ export const projectMembershipServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Member); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Member);
@@ -64,7 +64,7 @@ export const projectRoleServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Role); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Role);
const existingRole = await projectRoleDAL.findOne({ slug: data.slug, projectId }); const existingRole = await projectRoleDAL.findOne({ slug: data.slug, projectId });
@@ -102,7 +102,7 @@ export const projectRoleServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Role); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Role);
if (roleSlug !== "custom" && Object.values(ProjectMembershipRole).includes(roleSlug as ProjectMembershipRole)) { if (roleSlug !== "custom" && Object.values(ProjectMembershipRole).includes(roleSlug as ProjectMembershipRole)) {
@@ -125,7 +125,7 @@ export const projectRoleServiceFactory = ({
projectId: projectRole.projectId, projectId: projectRole.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Role); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Role);
@@ -153,7 +153,7 @@ export const projectRoleServiceFactory = ({
projectId: projectRole.projectId, projectId: projectRole.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Role); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Role);
@@ -195,7 +195,7 @@ export const projectRoleServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Role); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Role);
const customRoles = await projectRoleDAL.find( const customRoles = await projectRoleDAL.find(
@@ -218,7 +218,7 @@ export const projectRoleServiceFactory = ({
projectId, projectId,
authMethod: actorAuthMethod, authMethod: actorAuthMethod,
userOrgId: actorOrgId, userOrgId: actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
return { permissions: packRules(permission.rules), membership }; return { permissions: packRules(permission.rules), membership };
}; };
+23 -23
View File
@@ -439,7 +439,7 @@ export const projectServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Project); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Project);
@@ -523,7 +523,7 @@ export const projectServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
return project; return project;
}; };
@@ -537,7 +537,7 @@ export const projectServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Settings); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Settings);
@@ -563,7 +563,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Settings); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Settings);
@@ -592,7 +592,7 @@ export const projectServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
if (!hasRole(ProjectMembershipRole.Admin)) if (!hasRole(ProjectMembershipRole.Admin))
@@ -624,7 +624,7 @@ export const projectServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
if (!hasRole(ProjectMembershipRole.Admin)) { if (!hasRole(ProjectMembershipRole.Admin)) {
@@ -657,7 +657,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Settings); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Settings);
@@ -679,7 +679,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Project); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Project);
@@ -717,7 +717,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Secrets); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Secrets);
@@ -763,7 +763,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -814,7 +814,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Certificates); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Certificates);
@@ -869,7 +869,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.PkiAlerts); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.PkiAlerts);
@@ -905,7 +905,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.PkiCollections); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.PkiCollections);
@@ -942,7 +942,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.CertificateManager actionProjectType: ActionProjectType.CertificateManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -973,7 +973,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SSH actionProjectType: ActionProjectType.SSH
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -1009,7 +1009,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SSH actionProjectType: ActionProjectType.SSH
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SshCertificates); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SshCertificates);
@@ -1048,7 +1048,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SSH actionProjectType: ActionProjectType.SSH
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -1083,7 +1083,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Kms); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Kms);
@@ -1111,7 +1111,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Kms); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Kms);
@@ -1141,7 +1141,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Kms); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Kms);
@@ -1164,7 +1164,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
if (!membership) { if (!membership) {
@@ -1197,7 +1197,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Settings); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Settings);
@@ -1246,7 +1246,7 @@ export const projectServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Settings); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Settings);
@@ -37,7 +37,7 @@ export const secretBlindIndexServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const secretCount = await secretBlindIndexDAL.countOfSecretsWithNullSecretBlindIndex(projectId); const secretCount = await secretBlindIndexDAL.countOfSecretsWithNullSecretBlindIndex(projectId);
@@ -57,7 +57,7 @@ export const secretBlindIndexServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if (!hasRole(ProjectMembershipRole.Admin)) { if (!hasRole(ProjectMembershipRole.Admin)) {
throw new ForbiddenRequestError({ message: "Insufficient privileges, user must be admin" }); throw new ForbiddenRequestError({ message: "Insufficient privileges, user must be admin" });
@@ -81,7 +81,7 @@ export const secretBlindIndexServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if (!hasRole(ProjectMembershipRole.Admin)) { if (!hasRole(ProjectMembershipRole.Admin)) {
throw new ForbiddenRequestError({ message: "Insufficient privileges, user must be admin" }); throw new ForbiddenRequestError({ message: "Insufficient privileges, user must be admin" });
@@ -58,7 +58,7 @@ export const secretFolderServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -157,7 +157,7 @@ export const secretFolderServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
folders.forEach(({ environment, path: secretPath }) => { folders.forEach(({ environment, path: secretPath }) => {
@@ -267,7 +267,7 @@ export const secretFolderServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -348,7 +348,7 @@ export const secretFolderServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -405,7 +405,7 @@ export const secretFolderServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const env = await projectEnvDAL.findOne({ projectId, slug: environment }); const env = await projectEnvDAL.findOne({ projectId, slug: environment });
@@ -449,7 +449,7 @@ export const secretFolderServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const envs = await projectEnvDAL.findBySlugs(projectId, environments); const envs = await projectEnvDAL.findBySlugs(projectId, environments);
@@ -491,7 +491,7 @@ export const secretFolderServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const envs = await projectEnvDAL.findBySlugs(projectId, environments); const envs = await projectEnvDAL.findBySlugs(projectId, environments);
@@ -527,7 +527,7 @@ export const secretFolderServiceFactory = ({
projectId: folder.projectId, projectId: folder.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const [folderWithPath] = await folderDAL.findSecretPathByFolderIds(folder.projectId, [folder.id]); const [folderWithPath] = await folderDAL.findSecretPathByFolderIds(folder.projectId, [folder.id]);
@@ -556,7 +556,7 @@ export const secretFolderServiceFactory = ({
projectId, projectId,
actorAuthMethod: actor.authMethod, actorAuthMethod: actor.authMethod,
actorOrgId: actor.orgId, actorOrgId: actor.orgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const envs = await projectEnvDAL.findBySlugs(projectId, environments); const envs = await projectEnvDAL.findBySlugs(projectId, environments);
@@ -79,7 +79,7 @@ export const secretImportServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
// check if user has permission to import into destination path // check if user has permission to import into destination path
@@ -198,7 +198,7 @@ export const secretImportServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -294,7 +294,7 @@ export const secretImportServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -368,7 +368,7 @@ export const secretImportServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
// check if user has permission to import into destination path // check if user has permission to import into destination path
@@ -448,7 +448,7 @@ export const secretImportServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Read, ProjectPermissionActions.Read,
@@ -484,7 +484,7 @@ export const secretImportServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Read, ProjectPermissionActions.Read,
@@ -534,7 +534,7 @@ export const secretImportServiceFactory = ({
projectId: folder.projectId, projectId: folder.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -583,7 +583,7 @@ export const secretImportServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Read, ProjectPermissionActions.Read,
@@ -621,7 +621,7 @@ export const secretImportServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Read, ProjectPermissionActions.Read,
@@ -30,7 +30,7 @@ export const secretTagServiceFactory = ({ secretTagDAL, permissionService }: TSe
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Tags); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Tags);
@@ -62,7 +62,7 @@ export const secretTagServiceFactory = ({ secretTagDAL, permissionService }: TSe
projectId: tag.projectId, projectId: tag.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Tags); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Tags);
@@ -80,7 +80,7 @@ export const secretTagServiceFactory = ({ secretTagDAL, permissionService }: TSe
projectId: tag.projectId, projectId: tag.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Tags); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Tags);
@@ -98,7 +98,7 @@ export const secretTagServiceFactory = ({ secretTagDAL, permissionService }: TSe
projectId: tag.projectId, projectId: tag.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Tags); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Tags);
@@ -115,7 +115,7 @@ export const secretTagServiceFactory = ({ secretTagDAL, permissionService }: TSe
projectId: tag.projectId, projectId: tag.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Tags); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Tags);
@@ -129,7 +129,7 @@ export const secretTagServiceFactory = ({ secretTagDAL, permissionService }: TSe
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Tags); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Tags);
@@ -198,7 +198,7 @@ export const secretV2BridgeServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath); const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath);
@@ -326,7 +326,7 @@ export const secretV2BridgeServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if (inputSecret.newSecretName === "") { if (inputSecret.newSecretName === "") {
@@ -515,7 +515,7 @@ export const secretV2BridgeServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath); const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath);
@@ -617,7 +617,7 @@ export const secretV2BridgeServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Secrets); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Secrets);
@@ -664,7 +664,7 @@ export const secretV2BridgeServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Secrets); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Secrets);
@@ -748,7 +748,7 @@ export const secretV2BridgeServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if (!isInternal) { if (!isInternal) {
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Secrets); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Secrets);
@@ -798,7 +798,7 @@ export const secretV2BridgeServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Secrets); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Secrets);
@@ -952,7 +952,7 @@ export const secretV2BridgeServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const folder = await folderDAL.findBySecretPath(projectId, environment, path); const folder = await folderDAL.findBySecretPath(projectId, environment, path);
@@ -1109,7 +1109,7 @@ export const secretV2BridgeServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath); const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath);
@@ -1254,7 +1254,7 @@ export const secretV2BridgeServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath); const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath);
@@ -1465,7 +1465,7 @@ export const secretV2BridgeServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath); const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath);
@@ -1577,7 +1577,7 @@ export const secretV2BridgeServiceFactory = ({
projectId: folder.projectId, projectId: folder.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback);
const { decryptor: secretManagerDecryptor } = await kmsService.createCipherPairWithDataKey({ const { decryptor: secretManagerDecryptor } = await kmsService.createCipherPairWithDataKey({
@@ -1610,7 +1610,7 @@ export const secretV2BridgeServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if (!hasRole(ProjectMembershipRole.Admin)) if (!hasRole(ProjectMembershipRole.Admin))
@@ -1658,7 +1658,7 @@ export const secretV2BridgeServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const sourceFolder = await folderDAL.findBySecretPath(projectId, sourceEnvironment, sourceSecretPath); const sourceFolder = await folderDAL.findBySecretPath(projectId, sourceEnvironment, sourceSecretPath);
@@ -2016,7 +2016,7 @@ export const secretV2BridgeServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
+1 -1
View File
@@ -183,7 +183,7 @@ export const recursivelyGetSecretPaths = ({
projectId, projectId,
actorAuthMethod: auth.actorAuthMethod, actorAuthMethod: auth.actorAuthMethod,
actorOrgId: auth.actorOrgId, actorOrgId: auth.actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
// Filter out paths that the user does not have permission to access, and paths that are not in the current path // Filter out paths that the user does not have permission to access, and paths that are not in the current path
+15 -15
View File
@@ -197,7 +197,7 @@ export const secretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -315,7 +315,7 @@ export const secretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -460,7 +460,7 @@ export const secretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -557,7 +557,7 @@ export const secretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
let paths: { folderId: string; path: string }[] = []; let paths: { folderId: string; path: string }[] = [];
@@ -665,7 +665,7 @@ export const secretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Read, ProjectPermissionActions.Read,
@@ -765,7 +765,7 @@ export const secretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Create, ProjectPermissionActions.Create,
@@ -852,7 +852,7 @@ export const secretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -961,7 +961,7 @@ export const secretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Delete, ProjectPermissionActions.Delete,
@@ -2237,7 +2237,7 @@ export const secretServiceFactory = ({
projectId: folder.projectId, projectId: folder.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback);
const secretVersions = await secretVersionDAL.find({ secretId }, { offset, limit, sort: [["createdAt", "desc"]] }); const secretVersions = await secretVersionDAL.find({ secretId }, { offset, limit, sort: [["createdAt", "desc"]] });
@@ -2273,7 +2273,7 @@ export const secretServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -2379,7 +2379,7 @@ export const secretServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -2486,7 +2486,7 @@ export const secretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if (!hasRole(ProjectMembershipRole.Admin)) if (!hasRole(ProjectMembershipRole.Admin))
@@ -2571,7 +2571,7 @@ export const secretServiceFactory = ({
projectId: project.id, projectId: project.id,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan( ForbiddenError.from(permission).throwUnlessCan(
@@ -2960,7 +2960,7 @@ export const secretServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
if (!hasRole(ProjectMembershipRole.Admin)) if (!hasRole(ProjectMembershipRole.Admin))
@@ -2989,7 +2989,7 @@ export const secretServiceFactory = ({
projectId: params.projectId, projectId: params.projectId,
actorAuthMethod: actor.authMethod, actorAuthMethod: actor.authMethod,
actorOrgId: actor.orgId, actorOrgId: actor.orgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
const secrets = secretV2BridgeService.getSecretsByFolderMappings({ ...params, userId: actor.id }, permission); const secrets = secretV2BridgeService.getSecretsByFolderMappings({ ...params, userId: actor.id }, permission);
@@ -61,7 +61,7 @@ export const serviceTokenServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.ServiceTokens); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.ServiceTokens);
@@ -117,7 +117,7 @@ export const serviceTokenServiceFactory = ({
projectId: serviceToken.projectId, projectId: serviceToken.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.SecretManager actionProjectType: ActionProjectType.SecretManager
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.ServiceTokens); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.ServiceTokens);
@@ -152,7 +152,7 @@ export const serviceTokenServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.ServiceTokens); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.ServiceTokens);
@@ -51,7 +51,7 @@ export const webhookServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Webhooks); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Webhooks);
const env = await projectEnvDAL.findOne({ projectId, slug: environment }); const env = await projectEnvDAL.findOne({ projectId, slug: environment });
@@ -100,7 +100,7 @@ export const webhookServiceFactory = ({
projectId: webhook.projectId, projectId: webhook.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Webhooks); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Webhooks);
@@ -118,7 +118,7 @@ export const webhookServiceFactory = ({
projectId: webhook.projectId, projectId: webhook.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Webhooks); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Webhooks);
@@ -136,7 +136,7 @@ export const webhookServiceFactory = ({
projectId: webhook.projectId, projectId: webhook.projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
const project = await projectDAL.findById(webhook.projectId); const project = await projectDAL.findById(webhook.projectId);
@@ -180,7 +180,7 @@ export const webhookServiceFactory = ({
projectId, projectId,
actorAuthMethod, actorAuthMethod,
actorOrgId, actorOrgId,
projectOperationType: ActionProjectType.Any actionProjectType: ActionProjectType.Any
}); });
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Webhooks); ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Webhooks);