mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-18 15:04:59 +00:00
merge main
This commit is contained in:
@@ -237,8 +237,8 @@ export const projectServiceFactory = ({
|
||||
actorId,
|
||||
actorOrgId,
|
||||
actorAuthMethod,
|
||||
workspaceName,
|
||||
workspaceDescription,
|
||||
projectName: workspaceName,
|
||||
projectDescription: workspaceDescription,
|
||||
slug: projectSlug,
|
||||
kmsKeyId,
|
||||
tx: trx,
|
||||
@@ -254,7 +254,13 @@ export const projectServiceFactory = ({
|
||||
actorAuthMethod,
|
||||
actorOrgId
|
||||
);
|
||||
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Create, OrgPermissionSubjects.Workspace);
|
||||
|
||||
if (
|
||||
permission.cannot(OrgPermissionActions.Create, OrgPermissionSubjects.Workspace) &&
|
||||
permission.cannot(OrgPermissionActions.Create, OrgPermissionSubjects.Project)
|
||||
) {
|
||||
throw new ForbiddenRequestError({ message: "You don't have permission to create a project" });
|
||||
}
|
||||
|
||||
const results = await (trx || projectDAL).transaction(async (tx) => {
|
||||
await tx.raw("SELECT pg_advisory_xact_lock(?)", [PgSqlLock.CreateProject(organization.id)]);
|
||||
@@ -591,7 +597,8 @@ export const projectServiceFactory = ({
|
||||
secretSharing: update.secretSharing,
|
||||
defaultProduct: update.defaultProduct,
|
||||
showSnapshotsLegacy: update.showSnapshotsLegacy,
|
||||
secretDetectionIgnoreValues: update.secretDetectionIgnoreValues
|
||||
secretDetectionIgnoreValues: update.secretDetectionIgnoreValues,
|
||||
pitVersionLimit: update.pitVersionLimit
|
||||
});
|
||||
|
||||
return updatedProject;
|
||||
@@ -684,19 +691,21 @@ export const projectServiceFactory = ({
|
||||
actorOrgId,
|
||||
actorAuthMethod,
|
||||
auditLogsRetentionDays,
|
||||
workspaceSlug
|
||||
filter
|
||||
}: TUpdateAuditLogsRetentionDTO) => {
|
||||
const project = await projectDAL.findProjectBySlug(workspaceSlug, actorOrgId);
|
||||
const project = await projectDAL.findProjectByFilter(filter);
|
||||
const projectId = project.id;
|
||||
|
||||
if (!project) {
|
||||
throw new NotFoundError({
|
||||
message: `Project with slug '${workspaceSlug}' not found`
|
||||
message: `Project not found`
|
||||
});
|
||||
}
|
||||
|
||||
const { hasRole } = await permissionService.getProjectPermission({
|
||||
actor,
|
||||
actorId,
|
||||
projectId: project.id,
|
||||
projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId,
|
||||
actionProjectType: ActionProjectType.Any
|
||||
|
||||
@@ -42,12 +42,13 @@ export type TCreateProjectDTO = {
|
||||
actorAuthMethod: ActorAuthMethod;
|
||||
actorId: string;
|
||||
actorOrgId?: string;
|
||||
workspaceName: string;
|
||||
workspaceDescription?: string;
|
||||
projectName: string;
|
||||
projectDescription?: string;
|
||||
slug?: string;
|
||||
kmsKeyId?: string;
|
||||
createDefaultEnvs?: boolean;
|
||||
template?: string;
|
||||
pitVersionLimit?: number;
|
||||
tx?: Knex;
|
||||
type?: ProjectType;
|
||||
};
|
||||
@@ -78,7 +79,7 @@ export type TUpdateProjectVersionLimitDTO = {
|
||||
|
||||
export type TUpdateAuditLogsRetentionDTO = {
|
||||
auditLogsRetentionDays: number;
|
||||
workspaceSlug: string;
|
||||
filter: Filter;
|
||||
} & Omit<TProjectPermission, "projectId">;
|
||||
|
||||
export type TUpdateProjectNameDTO = {
|
||||
@@ -90,6 +91,7 @@ export type TUpdateProjectDTO = {
|
||||
update: {
|
||||
name?: string;
|
||||
description?: string;
|
||||
pitVersionLimit?: number;
|
||||
autoCapitalization?: boolean;
|
||||
hasDeleteProtection?: boolean;
|
||||
defaultProduct?: ProjectType;
|
||||
|
||||
Reference in New Issue
Block a user