mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 09:26:47 +00:00
feat: reptile feedback and resolved type failure
This commit is contained in:
@@ -10,7 +10,7 @@ export async function up(knex: Knex): Promise<void> {
|
|||||||
);
|
);
|
||||||
if (!hasStepColumn || !hasApprovalRequiredColumn) {
|
if (!hasStepColumn || !hasApprovalRequiredColumn) {
|
||||||
await knex.schema.alterTable(TableName.AccessApprovalPolicyApprover, (t) => {
|
await knex.schema.alterTable(TableName.AccessApprovalPolicyApprover, (t) => {
|
||||||
if (!hasStepColumn) t.integer("sequence").defaultTo(0);
|
if (!hasStepColumn) t.integer("sequence").defaultTo(1);
|
||||||
if (!hasApprovalRequiredColumn) t.integer("approvalsRequired").nullable();
|
if (!hasApprovalRequiredColumn) t.integer("approvalsRequired").nullable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,11 @@ export const registerAccessApprovalPolicyRouter = async (server: FastifyZodProvi
|
|||||||
])
|
])
|
||||||
.array()
|
.array()
|
||||||
.max(100, "Cannot have more than 100 approvers")
|
.max(100, "Cannot have more than 100 approvers")
|
||||||
.min(1, { message: "At least one approver should be provided" }),
|
.min(1, { message: "At least one approver should be provided" })
|
||||||
|
.refine(
|
||||||
|
(el) => el.every((i) => Object.hasOwn(i, "id") || Object.hasOwn(i, "username")),
|
||||||
|
"Must provide either username or id"
|
||||||
|
),
|
||||||
bypassers: z
|
bypassers: z
|
||||||
.discriminatedUnion("type", [
|
.discriminatedUnion("type", [
|
||||||
z.object({ type: z.literal(BypasserType.Group), id: z.string() }),
|
z.object({ type: z.literal(BypasserType.Group), id: z.string() }),
|
||||||
@@ -187,7 +191,11 @@ export const registerAccessApprovalPolicyRouter = async (server: FastifyZodProvi
|
|||||||
])
|
])
|
||||||
.array()
|
.array()
|
||||||
.min(1, { message: "At least one approver should be provided" })
|
.min(1, { message: "At least one approver should be provided" })
|
||||||
.max(100, "Cannot have more than 100 approvers"),
|
.max(100, "Cannot have more than 100 approvers")
|
||||||
|
.refine(
|
||||||
|
(el) => el.every((i) => Object.hasOwn(i, "id") || Object.hasOwn(i, "username")),
|
||||||
|
"Must provide either username or id"
|
||||||
|
),
|
||||||
bypassers: z
|
bypassers: z
|
||||||
.discriminatedUnion("type", [
|
.discriminatedUnion("type", [
|
||||||
z.object({ type: z.literal(BypasserType.Group), id: z.string() }),
|
z.object({ type: z.literal(BypasserType.Group), id: z.string() }),
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ export const accessApprovalPolicyDALFactory = (db: TDbClient) => {
|
|||||||
.select(tx.ref("approverGroupId").withSchema(TableName.AccessApprovalPolicyApprover))
|
.select(tx.ref("approverGroupId").withSchema(TableName.AccessApprovalPolicyApprover))
|
||||||
.select(tx.ref("sequence").withSchema(TableName.AccessApprovalPolicyApprover).as("approverSequence"))
|
.select(tx.ref("sequence").withSchema(TableName.AccessApprovalPolicyApprover).as("approverSequence"))
|
||||||
.select(tx.ref("approvalsRequired").withSchema(TableName.AccessApprovalPolicyApprover))
|
.select(tx.ref("approvalsRequired").withSchema(TableName.AccessApprovalPolicyApprover))
|
||||||
.select(tx.ref("approverGroupId").withSchema(TableName.AccessApprovalPolicyApprover))
|
|
||||||
.select(tx.ref("bypasserUserId").withSchema(TableName.AccessApprovalPolicyBypasser))
|
.select(tx.ref("bypasserUserId").withSchema(TableName.AccessApprovalPolicyBypasser))
|
||||||
.select(tx.ref("bypasserGroupId").withSchema(TableName.AccessApprovalPolicyBypasser))
|
.select(tx.ref("bypasserGroupId").withSchema(TableName.AccessApprovalPolicyBypasser))
|
||||||
.select(tx.ref("name").withSchema(TableName.Environment).as("envName"))
|
.select(tx.ref("name").withSchema(TableName.Environment).as("envName"))
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ export const accessApprovalPolicyServiceFactory = ({
|
|||||||
|
|
||||||
approverUserIds = approverUserIds.concat(
|
approverUserIds = approverUserIds.concat(
|
||||||
userApproverNames.map((el) => ({
|
userApproverNames.map((el) => ({
|
||||||
id: approverUsersInDBGroupByUsername[el.username]?.[0].username,
|
id: approverUsersInDBGroupByUsername[el.username]?.[0].id,
|
||||||
sequence: el.sequence
|
sequence: el.sequence
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
@@ -427,7 +427,7 @@ export const accessApprovalPolicyServiceFactory = ({
|
|||||||
|
|
||||||
approverUserIds = approverUserIds.concat(
|
approverUserIds = approverUserIds.concat(
|
||||||
userApproverNames.map((el) => ({
|
userApproverNames.map((el) => ({
|
||||||
id: approverUsersInDBGroupByUsername[el.username]?.[0].username,
|
id: approverUsersInDBGroupByUsername[el.username]?.[0].id,
|
||||||
sequence: el.sequence
|
sequence: el.sequence
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -36,12 +36,12 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({
|
|||||||
oidcSSO: false,
|
oidcSSO: false,
|
||||||
scim: false,
|
scim: false,
|
||||||
ldap: false,
|
ldap: false,
|
||||||
groups: true,
|
groups: false,
|
||||||
status: null,
|
status: null,
|
||||||
trial_end: null,
|
trial_end: null,
|
||||||
has_used_trial: true,
|
has_used_trial: true,
|
||||||
secretApproval: true,
|
secretApproval: false,
|
||||||
secretRotation: true,
|
secretRotation: false,
|
||||||
caCrl: false,
|
caCrl: false,
|
||||||
instanceUserManagement: false,
|
instanceUserManagement: false,
|
||||||
externalKms: false,
|
externalKms: false,
|
||||||
|
|||||||
+1
-1
@@ -158,7 +158,7 @@ export const AccessPolicyForm = ({
|
|||||||
?.sort((a, b) => (a?.sequence || 0) - (b?.sequence || 0))
|
?.sort((a, b) => (a?.sequence || 0) - (b?.sequence || 0))
|
||||||
.reduce(
|
.reduce(
|
||||||
(acc, curr) => {
|
(acc, curr) => {
|
||||||
if (acc.length > 1 && acc[acc.length - 1].sequence === curr.sequence) {
|
if (acc.length && acc[acc.length - 1].sequence === curr.sequence) {
|
||||||
acc[acc.length - 1][curr.type]?.push(curr);
|
acc[acc.length - 1][curr.type]?.push(curr);
|
||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user