mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-26 17:19:09 +00:00
Fix inline policy fields in resource update response
This commit is contained in:
19
server/routers/resource/inlinePolicyFields.ts
Normal file
19
server/routers/resource/inlinePolicyFields.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import type { Resource, ResourcePolicy } from "@server/db";
|
||||
|
||||
type InlinePolicyFields = Pick<
|
||||
ResourcePolicy,
|
||||
"sso" | "emailWhitelistEnabled" | "applyRules" | "idpId"
|
||||
>;
|
||||
|
||||
export function applyInlinePolicyFields<T extends Resource>(
|
||||
resource: T,
|
||||
policy: InlinePolicyFields | null | undefined
|
||||
): T {
|
||||
return {
|
||||
...resource,
|
||||
sso: policy?.sso ?? null,
|
||||
emailWhitelistEnabled: policy?.emailWhitelistEnabled ?? null,
|
||||
applyRules: policy?.applyRules ?? null,
|
||||
skipToIdpId: policy?.idpId ?? null
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user