2022-01-03 15:00:03 +00:00
|
|
|
import { useServerInfo } from "../context/server-info/ServerInfoProvider";
|
|
|
|
|
|
|
|
export enum Feature {
|
2023-04-18 16:50:46 +00:00
|
|
|
AdminFineGrainedAuthz = "ADMIN_FINE_GRAINED_AUTHZ",
|
|
|
|
ClientPolicies = "CLIENT_POLICIES",
|
2022-01-03 15:00:03 +00:00
|
|
|
DeclarativeUserProfile = "DECLARATIVE_USER_PROFILE",
|
2023-04-18 16:50:46 +00:00
|
|
|
Kerberos = "KERBEROS",
|
2022-01-03 15:00:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default function useIsFeatureEnabled() {
|
|
|
|
const { profileInfo } = useServerInfo();
|
|
|
|
const disabledFilters = profileInfo?.disabledFeatures ?? [];
|
|
|
|
|
|
|
|
return function isFeatureEnabled(feature: Feature) {
|
2023-04-18 16:50:46 +00:00
|
|
|
return !disabledFilters.includes(feature);
|
2022-01-03 15:00:03 +00:00
|
|
|
};
|
|
|
|
}
|