mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
temp commit for branch switching
This commit is contained in:
parent
b30c17c72d
commit
f1bca73431
4 changed files with 62 additions and 0 deletions
|
|
@ -28,6 +28,7 @@ export interface SSOSettingsValues {
|
|||
user_email: string | null;
|
||||
ui_access_mode: string | null;
|
||||
role_mappings: RoleMappings;
|
||||
team_mappings: TeamMappings;
|
||||
}
|
||||
|
||||
export interface RoleMappings {
|
||||
|
|
@ -39,6 +40,10 @@ export interface RoleMappings {
|
|||
};
|
||||
}
|
||||
|
||||
export interface TeamMappings {
|
||||
team_id_jwt_field: string;
|
||||
}
|
||||
|
||||
export interface SSOSettingsResponse {
|
||||
values: SSOSettingsValues;
|
||||
field_schema: SSOFieldSchema;
|
||||
|
|
|
|||
|
|
@ -251,6 +251,43 @@ const BaseSSOSettingsForm: React.FC<BaseSSOSettingsFormProps> = ({ form, onFormS
|
|||
) : null;
|
||||
}}
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(prevValues, currentValues) => prevValues.sso_provider !== currentValues.sso_provider}
|
||||
>
|
||||
{({ getFieldValue }) => {
|
||||
const provider = getFieldValue("sso_provider");
|
||||
return provider === "okta" || provider === "generic" ? (
|
||||
<Form.Item label="Use Team Mappings" name="use_team_mappings" valuePropName="checked">
|
||||
<Checkbox />
|
||||
</Form.Item>
|
||||
) : null;
|
||||
}}
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(prevValues, currentValues) =>
|
||||
prevValues.use_team_mappings !== currentValues.use_team_mappings ||
|
||||
prevValues.sso_provider !== currentValues.sso_provider
|
||||
}
|
||||
>
|
||||
{({ getFieldValue }) => {
|
||||
const useTeamMappings = getFieldValue("use_team_mappings");
|
||||
const provider = getFieldValue("sso_provider");
|
||||
const supportsTeamMappings = provider === "okta" || provider === "generic";
|
||||
return useTeamMappings && supportsTeamMappings ? (
|
||||
<Form.Item
|
||||
label="Team IDs JWT Field"
|
||||
name="team_ids_jwt_field"
|
||||
rules={[{ required: true, message: "Please enter the team IDs JWT field" }]}
|
||||
>
|
||||
<TextInput />
|
||||
</Form.Item>
|
||||
) : null;
|
||||
}}
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -68,11 +68,22 @@ const EditSSOSettingsModal: React.FC<EditSSOSettingsModalProps> = ({ isVisible,
|
|||
};
|
||||
}
|
||||
|
||||
// Extract team mappings if they exist
|
||||
let teamMappingFields = {};
|
||||
if (ssoData.values.team_mappings) {
|
||||
const teamMappings = ssoData.values.team_mappings;
|
||||
teamMappingFields = {
|
||||
use_team_mappings: true,
|
||||
team_ids_jwt_field: teamMappings.team_ids_jwt_field,
|
||||
};
|
||||
}
|
||||
|
||||
// Set form values with existing data (excluding UI access control fields)
|
||||
const formValues = {
|
||||
sso_provider: selectedProvider,
|
||||
...ssoData.values,
|
||||
...roleMappingFields,
|
||||
...teamMappingFields,
|
||||
};
|
||||
|
||||
console.log("Setting form values:", formValues); // Debug log
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ export const processSSOSettingsPayload = (formValues: Record<string, any>): Reco
|
|||
default_role,
|
||||
group_claim,
|
||||
use_role_mappings,
|
||||
use_team_mappings,
|
||||
team_ids_jwt_field,
|
||||
...rest
|
||||
} = formValues;
|
||||
|
||||
|
|
@ -52,6 +54,13 @@ export const processSSOSettingsPayload = (formValues: Record<string, any>): Reco
|
|||
};
|
||||
}
|
||||
|
||||
// Add team mappings only if use_team_mappings is checked
|
||||
if (use_team_mappings) {
|
||||
payload.team_mappings = {
|
||||
team_ids_jwt_field: team_ids_jwt_field,
|
||||
};
|
||||
}
|
||||
|
||||
return payload;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue