mirror of
https://github.com/fosrl/pangolin.git
synced 2026-01-28 22:00:51 +00:00
add optional tags field to idp
This commit is contained in:
@@ -591,7 +591,8 @@ export const idp = pgTable("idp", {
|
|||||||
type: varchar("type").notNull(),
|
type: varchar("type").notNull(),
|
||||||
defaultRoleMapping: varchar("defaultRoleMapping"),
|
defaultRoleMapping: varchar("defaultRoleMapping"),
|
||||||
defaultOrgMapping: varchar("defaultOrgMapping"),
|
defaultOrgMapping: varchar("defaultOrgMapping"),
|
||||||
autoProvision: boolean("autoProvision").notNull().default(false)
|
autoProvision: boolean("autoProvision").notNull().default(false),
|
||||||
|
tags: text("tags")
|
||||||
});
|
});
|
||||||
|
|
||||||
export const idpOidcConfig = pgTable("idpOidcConfig", {
|
export const idpOidcConfig = pgTable("idpOidcConfig", {
|
||||||
|
|||||||
@@ -777,7 +777,8 @@ export const idp = sqliteTable("idp", {
|
|||||||
mode: "boolean"
|
mode: "boolean"
|
||||||
})
|
})
|
||||||
.notNull()
|
.notNull()
|
||||||
.default(false)
|
.default(false),
|
||||||
|
tags: text("tags")
|
||||||
});
|
});
|
||||||
|
|
||||||
// Identity Provider OAuth Configuration
|
// Identity Provider OAuth Configuration
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ const bodySchema = z.strictObject({
|
|||||||
scopes: z.string().nonempty(),
|
scopes: z.string().nonempty(),
|
||||||
autoProvision: z.boolean().optional(),
|
autoProvision: z.boolean().optional(),
|
||||||
variant: z.enum(["oidc", "google", "azure"]).optional().default("oidc"),
|
variant: z.enum(["oidc", "google", "azure"]).optional().default("oidc"),
|
||||||
roleMapping: z.string().optional()
|
roleMapping: z.string().optional(),
|
||||||
|
tags: z.string().optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
@@ -104,7 +105,8 @@ export async function createOrgOidcIdp(
|
|||||||
name,
|
name,
|
||||||
autoProvision,
|
autoProvision,
|
||||||
variant,
|
variant,
|
||||||
roleMapping
|
roleMapping,
|
||||||
|
tags
|
||||||
} = parsedBody.data;
|
} = parsedBody.data;
|
||||||
|
|
||||||
if (build === "saas") {
|
if (build === "saas") {
|
||||||
@@ -132,7 +134,8 @@ export async function createOrgOidcIdp(
|
|||||||
.values({
|
.values({
|
||||||
name,
|
name,
|
||||||
autoProvision,
|
autoProvision,
|
||||||
type: "oidc"
|
type: "oidc",
|
||||||
|
tags
|
||||||
})
|
})
|
||||||
.returning();
|
.returning();
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ async function query(orgId: string, limit: number, offset: number) {
|
|||||||
orgId: idpOrg.orgId,
|
orgId: idpOrg.orgId,
|
||||||
name: idp.name,
|
name: idp.name,
|
||||||
type: idp.type,
|
type: idp.type,
|
||||||
variant: idpOidcConfig.variant
|
variant: idpOidcConfig.variant,
|
||||||
|
tags: idp.tags
|
||||||
})
|
})
|
||||||
.from(idpOrg)
|
.from(idpOrg)
|
||||||
.where(eq(idpOrg.orgId, orgId))
|
.where(eq(idpOrg.orgId, orgId))
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ const bodySchema = z.strictObject({
|
|||||||
namePath: z.string().optional(),
|
namePath: z.string().optional(),
|
||||||
scopes: z.string().optional(),
|
scopes: z.string().optional(),
|
||||||
autoProvision: z.boolean().optional(),
|
autoProvision: z.boolean().optional(),
|
||||||
roleMapping: z.string().optional()
|
roleMapping: z.string().optional(),
|
||||||
|
tags: z.string().optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
export type UpdateOrgIdpResponse = {
|
export type UpdateOrgIdpResponse = {
|
||||||
@@ -109,7 +110,8 @@ export async function updateOrgOidcIdp(
|
|||||||
namePath,
|
namePath,
|
||||||
name,
|
name,
|
||||||
autoProvision,
|
autoProvision,
|
||||||
roleMapping
|
roleMapping,
|
||||||
|
tags
|
||||||
} = parsedBody.data;
|
} = parsedBody.data;
|
||||||
|
|
||||||
if (build === "saas") {
|
if (build === "saas") {
|
||||||
@@ -167,7 +169,8 @@ export async function updateOrgOidcIdp(
|
|||||||
await db.transaction(async (trx) => {
|
await db.transaction(async (trx) => {
|
||||||
const idpData = {
|
const idpData = {
|
||||||
name,
|
name,
|
||||||
autoProvision
|
autoProvision,
|
||||||
|
tags
|
||||||
};
|
};
|
||||||
|
|
||||||
// only update if at least one key is not undefined
|
// only update if at least one key is not undefined
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ const bodySchema = z.strictObject({
|
|||||||
emailPath: z.string().optional(),
|
emailPath: z.string().optional(),
|
||||||
namePath: z.string().optional(),
|
namePath: z.string().optional(),
|
||||||
scopes: z.string().nonempty(),
|
scopes: z.string().nonempty(),
|
||||||
autoProvision: z.boolean().optional()
|
autoProvision: z.boolean().optional(),
|
||||||
|
tags: z.string().optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
export type CreateIdpResponse = {
|
export type CreateIdpResponse = {
|
||||||
@@ -75,7 +76,8 @@ export async function createOidcIdp(
|
|||||||
emailPath,
|
emailPath,
|
||||||
namePath,
|
namePath,
|
||||||
name,
|
name,
|
||||||
autoProvision
|
autoProvision,
|
||||||
|
tags
|
||||||
} = parsedBody.data;
|
} = parsedBody.data;
|
||||||
|
|
||||||
const key = config.getRawConfig().server.secret!;
|
const key = config.getRawConfig().server.secret!;
|
||||||
@@ -90,7 +92,8 @@ export async function createOidcIdp(
|
|||||||
.values({
|
.values({
|
||||||
name,
|
name,
|
||||||
autoProvision,
|
autoProvision,
|
||||||
type: "oidc"
|
type: "oidc",
|
||||||
|
tags
|
||||||
})
|
})
|
||||||
.returning();
|
.returning();
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ async function query(limit: number, offset: number) {
|
|||||||
type: idp.type,
|
type: idp.type,
|
||||||
variant: idpOidcConfig.variant,
|
variant: idpOidcConfig.variant,
|
||||||
orgCount: sql<number>`count(${idpOrg.orgId})`,
|
orgCount: sql<number>`count(${idpOrg.orgId})`,
|
||||||
autoProvision: idp.autoProvision
|
autoProvision: idp.autoProvision,
|
||||||
|
tags: idp.tags
|
||||||
})
|
})
|
||||||
.from(idp)
|
.from(idp)
|
||||||
.leftJoin(idpOrg, sql`${idp.idpId} = ${idpOrg.idpId}`)
|
.leftJoin(idpOrg, sql`${idp.idpId} = ${idpOrg.idpId}`)
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ const bodySchema = z.strictObject({
|
|||||||
scopes: z.string().optional(),
|
scopes: z.string().optional(),
|
||||||
autoProvision: z.boolean().optional(),
|
autoProvision: z.boolean().optional(),
|
||||||
defaultRoleMapping: z.string().optional(),
|
defaultRoleMapping: z.string().optional(),
|
||||||
defaultOrgMapping: z.string().optional()
|
defaultOrgMapping: z.string().optional(),
|
||||||
|
tags: z.string().optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
export type UpdateIdpResponse = {
|
export type UpdateIdpResponse = {
|
||||||
@@ -94,7 +95,8 @@ export async function updateOidcIdp(
|
|||||||
name,
|
name,
|
||||||
autoProvision,
|
autoProvision,
|
||||||
defaultRoleMapping,
|
defaultRoleMapping,
|
||||||
defaultOrgMapping
|
defaultOrgMapping,
|
||||||
|
tags
|
||||||
} = parsedBody.data;
|
} = parsedBody.data;
|
||||||
|
|
||||||
// Check if IDP exists and is of type OIDC
|
// Check if IDP exists and is of type OIDC
|
||||||
@@ -127,7 +129,8 @@ export async function updateOidcIdp(
|
|||||||
name,
|
name,
|
||||||
autoProvision,
|
autoProvision,
|
||||||
defaultRoleMapping,
|
defaultRoleMapping,
|
||||||
defaultOrgMapping
|
defaultOrgMapping,
|
||||||
|
tags
|
||||||
};
|
};
|
||||||
|
|
||||||
// only update if at least one key is not undefined
|
// only update if at least one key is not undefined
|
||||||
|
|||||||
Reference in New Issue
Block a user