mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-05 18:26:40 +00:00
add license system and ui
This commit is contained in:
@@ -11,6 +11,7 @@ import { idp, idpOidcConfig } from "@server/db/schemas";
|
||||
import { generateOidcRedirectUrl } from "@server/lib/idp/generateRedirectUrl";
|
||||
import { encrypt } from "@server/lib/crypto";
|
||||
import config from "@server/lib/config";
|
||||
import license from "@server/license/license";
|
||||
|
||||
const paramsSchema = z.object({}).strict();
|
||||
|
||||
@@ -67,7 +68,7 @@ export async function createOidcIdp(
|
||||
);
|
||||
}
|
||||
|
||||
const {
|
||||
let {
|
||||
clientId,
|
||||
clientSecret,
|
||||
authUrl,
|
||||
@@ -80,6 +81,10 @@ export async function createOidcIdp(
|
||||
autoProvision
|
||||
} = parsedBody.data;
|
||||
|
||||
if (!(await license.isUnlocked())) {
|
||||
autoProvision = false;
|
||||
}
|
||||
|
||||
const key = config.getRawConfig().server.secret;
|
||||
|
||||
const encryptedSecret = encrypt(clientSecret, key);
|
||||
|
||||
@@ -11,6 +11,7 @@ import { idp, idpOidcConfig } from "@server/db/schemas";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { encrypt } from "@server/lib/crypto";
|
||||
import config from "@server/lib/config";
|
||||
import license from "@server/license/license";
|
||||
|
||||
const paramsSchema = z
|
||||
.object({
|
||||
@@ -84,7 +85,7 @@ export async function updateOidcIdp(
|
||||
}
|
||||
|
||||
const { idpId } = parsedParams.data;
|
||||
const {
|
||||
let {
|
||||
clientId,
|
||||
clientSecret,
|
||||
authUrl,
|
||||
@@ -99,6 +100,10 @@ export async function updateOidcIdp(
|
||||
defaultOrgMapping
|
||||
} = parsedBody.data;
|
||||
|
||||
if (!(await license.isUnlocked())) {
|
||||
autoProvision = false;
|
||||
}
|
||||
|
||||
// Check if IDP exists and is of type OIDC
|
||||
const [existingIdp] = await db
|
||||
.select()
|
||||
|
||||
Reference in New Issue
Block a user