forked from phoenix/litellm-mirror
check if premium user for sso / allowed ip
This commit is contained in:
parent
f7002ecd08
commit
8195a4eacc
2 changed files with 13 additions and 2 deletions
|
@ -221,6 +221,7 @@ const CreateKeyPage = () => {
|
||||||
searchParams={searchParams}
|
searchParams={searchParams}
|
||||||
accessToken={accessToken}
|
accessToken={accessToken}
|
||||||
showSSOBanner={showSSOBanner}
|
showSSOBanner={showSSOBanner}
|
||||||
|
premiumUser={premiumUser}
|
||||||
/>
|
/>
|
||||||
) : page == "api_ref" ? (
|
) : page == "api_ref" ? (
|
||||||
<APIRef
|
<APIRef
|
||||||
|
|
|
@ -40,6 +40,7 @@ interface AdminPanelProps {
|
||||||
accessToken: string | null;
|
accessToken: string | null;
|
||||||
setTeams: React.Dispatch<React.SetStateAction<Object[] | null>>;
|
setTeams: React.Dispatch<React.SetStateAction<Object[] | null>>;
|
||||||
showSSOBanner: boolean;
|
showSSOBanner: boolean;
|
||||||
|
premiumUser: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -59,6 +60,7 @@ const AdminPanel: React.FC<AdminPanelProps> = ({
|
||||||
searchParams,
|
searchParams,
|
||||||
accessToken,
|
accessToken,
|
||||||
showSSOBanner,
|
showSSOBanner,
|
||||||
|
premiumUser,
|
||||||
}) => {
|
}) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [memberForm] = Form.useForm();
|
const [memberForm] = Form.useForm();
|
||||||
|
@ -105,6 +107,12 @@ const AdminPanel: React.FC<AdminPanelProps> = ({
|
||||||
|
|
||||||
const handleShowAllowedIPs = async () => {
|
const handleShowAllowedIPs = async () => {
|
||||||
try {
|
try {
|
||||||
|
if (premiumUser !== true) {
|
||||||
|
message.error(
|
||||||
|
"This feature is only available for premium users. Please upgrade your account."
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
if (accessToken) {
|
if (accessToken) {
|
||||||
const data = await getAllowedIPs(accessToken);
|
const data = await getAllowedIPs(accessToken);
|
||||||
setAllowedIPs(data && data.length > 0 ? data : [all_ip_address_allowed]);
|
setAllowedIPs(data && data.length > 0 ? data : [all_ip_address_allowed]);
|
||||||
|
@ -116,8 +124,10 @@ const AdminPanel: React.FC<AdminPanelProps> = ({
|
||||||
message.error(`Failed to fetch allowed IPs ${error}`);
|
message.error(`Failed to fetch allowed IPs ${error}`);
|
||||||
setAllowedIPs([all_ip_address_allowed]);
|
setAllowedIPs([all_ip_address_allowed]);
|
||||||
} finally {
|
} finally {
|
||||||
|
if (premiumUser === true) {
|
||||||
setIsAllowedIPModalVisible(true);
|
setIsAllowedIPModalVisible(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAddIP = async (values: { ip: string }) => {
|
const handleAddIP = async (values: { ip: string }) => {
|
||||||
|
@ -605,7 +615,7 @@ const AdminPanel: React.FC<AdminPanelProps> = ({
|
||||||
<Title level={4}> ✨ Security Settings</Title>
|
<Title level={4}> ✨ Security Settings</Title>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem', marginTop: '1rem' }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem', marginTop: '1rem' }}>
|
||||||
<div>
|
<div>
|
||||||
<Button onClick={() => setIsAddSSOModalVisible(true)}>Add SSO</Button>
|
<Button onClick={() => premiumUser === true ? setIsAddSSOModalVisible(true) : message.error("Only premium users can add SSO")}>Add SSO</Button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Button onClick={handleShowAllowedIPs}>Allowed IPs</Button>
|
<Button onClick={handleShowAllowedIPs}>Allowed IPs</Button>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue