parent
7e2565c9fe
commit
e4cc7825f3
3 changed files with 51 additions and 4 deletions
|
@ -92,7 +92,20 @@
|
|||
"realm": "${realm.name}",
|
||||
"resourceUrl": "${resourceUrl}",
|
||||
"logo": "${properties.logo!""}",
|
||||
"logoUrl": "${properties.logoUrl!""}"
|
||||
"logoUrl": "${properties.logoUrl!""}",
|
||||
"features": {
|
||||
"isRegistrationEmailAsUsername": ${realm.registrationEmailAsUsername?c},
|
||||
"isEditUserNameAllowed": ${realm.editUsernameAllowed?c},
|
||||
"isInternationalizationEnabled": ${realm.isInternationalizationEnabled()?c},
|
||||
"isLinkedAccountsEnabled": ${realm.identityFederationEnabled?c},
|
||||
"isEventsEnabled": ${isEventsEnabled?c},
|
||||
"isMyResourcesEnabled": ${(realm.userManagedAccessAllowed && isAuthorizationEnabled)?c},
|
||||
"isTotpConfigured": ${isTotpConfigured?c},
|
||||
"deleteAccountAllowed": ${deleteAccountAllowed?c},
|
||||
"updateEmailFeatureEnabled": ${updateEmailFeatureEnabled?c},
|
||||
"updateEmailActionEnabled": ${updateEmailActionEnabled?c},
|
||||
"isViewGroupsEnabled": ${isViewGroupsEnabled?c}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -11,6 +11,20 @@ export type Environment = {
|
|||
logo: string;
|
||||
/** Indicates the url to be followed when Brand image is clicked */
|
||||
logoUrl: string;
|
||||
/** Feature flags */
|
||||
features: {
|
||||
isRegistrationEmailAsUsername: boolean;
|
||||
isEditUserNameAllowed: boolean;
|
||||
isInternationalizationEnabled: boolean;
|
||||
isLinkedAccountsEnabled: boolean;
|
||||
isEventsEnabled: boolean;
|
||||
isMyResourcesEnabled: boolean;
|
||||
isTotpConfigured: boolean;
|
||||
deleteAccountAllowed: boolean;
|
||||
updateEmailFeatureEnabled: boolean;
|
||||
updateEmailActionEnabled: boolean;
|
||||
isViewGroupsEnabled: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
// The default environment, used during development.
|
||||
|
@ -21,6 +35,19 @@ const defaultEnvironment: Environment = {
|
|||
resourceUrl: "http://localhost:8080",
|
||||
logo: "/logo.svg",
|
||||
logoUrl: "/",
|
||||
features: {
|
||||
isRegistrationEmailAsUsername: false,
|
||||
isEditUserNameAllowed: true,
|
||||
isInternationalizationEnabled: true,
|
||||
isLinkedAccountsEnabled: true,
|
||||
isEventsEnabled: true,
|
||||
isMyResourcesEnabled: true,
|
||||
isTotpConfigured: true,
|
||||
deleteAccountAllowed: true,
|
||||
updateEmailFeatureEnabled: true,
|
||||
updateEmailActionEnabled: true,
|
||||
isViewGroupsEnabled: true,
|
||||
},
|
||||
};
|
||||
|
||||
// Merge the default and injected environment variables together.
|
||||
|
|
|
@ -19,15 +19,18 @@ import {
|
|||
useLinkClickHandler,
|
||||
useLocation,
|
||||
} from "react-router-dom";
|
||||
import { environment } from "../environment";
|
||||
|
||||
type RootMenuItem = {
|
||||
label: TFuncKey;
|
||||
path: string;
|
||||
isHidden?: boolean;
|
||||
};
|
||||
|
||||
type MenuItemWithChildren = {
|
||||
label: TFuncKey;
|
||||
children: MenuItem[];
|
||||
isHidden?: boolean;
|
||||
};
|
||||
|
||||
type MenuItem = RootMenuItem | MenuItemWithChildren;
|
||||
|
@ -61,10 +64,12 @@ const menuItems: MenuItem[] = [
|
|||
{
|
||||
label: "groups",
|
||||
path: "groups",
|
||||
isHidden: !environment.features.isViewGroupsEnabled,
|
||||
},
|
||||
{
|
||||
label: "resources",
|
||||
path: "resources",
|
||||
isHidden: !environment.features.isMyResourcesEnabled,
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -73,9 +78,11 @@ export const PageNav = () => (
|
|||
nav={
|
||||
<Nav>
|
||||
<NavList>
|
||||
{menuItems.map((menuItem) => (
|
||||
<NavMenuItem key={menuItem.label} menuItem={menuItem} />
|
||||
))}
|
||||
{menuItems
|
||||
.filter((menuItem) => !menuItem.isHidden)
|
||||
.map((menuItem) => (
|
||||
<NavMenuItem key={menuItem.label} menuItem={menuItem} />
|
||||
))}
|
||||
</NavList>
|
||||
</Nav>
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue