Add check for enable identity services
This commit is contained in:
parent
ae294f7e64
commit
b354c305cf
@ -46,6 +46,8 @@ const PrivateRouteWrapper = ({
|
||||
restricted,
|
||||
withCollaborator,
|
||||
withManager,
|
||||
identityServerEnabled,
|
||||
limitedAccessSpace,
|
||||
}: Partial<PrivateRouteProps>) => {
|
||||
return (
|
||||
<PrivateRoute
|
||||
@ -64,6 +66,8 @@ const PrivateRouteWrapper = ({
|
||||
withCollaborator={withCollaborator}
|
||||
isPortalDeactivate={isPortalDeactivate!}
|
||||
enablePortalRename={enablePortalRename!}
|
||||
identityServerEnabled={identityServerEnabled}
|
||||
limitedAccessSpace={limitedAccessSpace ?? null}
|
||||
>
|
||||
{children}
|
||||
</PrivateRoute>
|
||||
@ -80,7 +84,10 @@ export default inject<TStore>(
|
||||
isLogout,
|
||||
isCommunity,
|
||||
isEnterprise,
|
||||
capabilities,
|
||||
} = authStore;
|
||||
|
||||
const identityServerEnabled = capabilities?.identityServerEnabled;
|
||||
const { isNotPaidPeriod } = currentTariffStatusStore;
|
||||
const { user } = userStore;
|
||||
|
||||
@ -89,6 +96,7 @@ export default inject<TStore>(
|
||||
tenantStatus,
|
||||
isPortalDeactivate,
|
||||
enablePortalRename,
|
||||
limitedAccessSpace,
|
||||
} = settingsStore;
|
||||
|
||||
return {
|
||||
@ -104,6 +112,8 @@ export default inject<TStore>(
|
||||
isLogout,
|
||||
isEnterprise,
|
||||
enablePortalRename,
|
||||
identityServerEnabled,
|
||||
limitedAccessSpace,
|
||||
};
|
||||
},
|
||||
)(observer(PrivateRouteWrapper));
|
||||
|
@ -48,7 +48,7 @@ import OAuth from "./OAuth";
|
||||
import SSOLoader from "./sub-components/ssoLoader";
|
||||
|
||||
const DeveloperToolsWrapper = (props) => {
|
||||
const { loadBaseInfo, currentDeviceType } = props;
|
||||
const { loadBaseInfo, currentDeviceType, identityServerEnabled } = props;
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
@ -107,12 +107,15 @@ const DeveloperToolsWrapper = (props) => {
|
||||
name: t("Webhooks:Webhooks"),
|
||||
content: <Webhooks />,
|
||||
},
|
||||
{
|
||||
];
|
||||
|
||||
if (identityServerEnabled) {
|
||||
data.push({
|
||||
id: "oauth",
|
||||
name: t("OAuth:OAuth"),
|
||||
content: <OAuth />,
|
||||
},
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
const load = async () => {
|
||||
//await loadBaseInfo();
|
||||
@ -155,13 +158,16 @@ const DeveloperToolsWrapper = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ setup, settingsStore }) => {
|
||||
export default inject(({ setup, settingsStore, authStore }) => {
|
||||
const { initSettings } = setup;
|
||||
|
||||
const { identityServerEnabled } = authStore.capabilities;
|
||||
|
||||
return {
|
||||
currentDeviceType: settingsStore.currentDeviceType,
|
||||
loadBaseInfo: async () => {
|
||||
await initSettings();
|
||||
},
|
||||
identityServerEnabled,
|
||||
};
|
||||
})(observer(DeveloperToolsWrapper));
|
||||
|
@ -65,7 +65,13 @@ const StyledTabs = styled(Tabs)`
|
||||
`;
|
||||
|
||||
const SectionBodyContent = (props) => {
|
||||
const { showProfileLoader, profile, currentDeviceType, t } = props;
|
||||
const {
|
||||
showProfileLoader,
|
||||
profile,
|
||||
currentDeviceType,
|
||||
identityServerEnabled,
|
||||
t,
|
||||
} = props;
|
||||
const navigate = useNavigate();
|
||||
|
||||
const data = [
|
||||
@ -84,12 +90,15 @@ const SectionBodyContent = (props) => {
|
||||
name: t("InterfaceTheme"),
|
||||
content: <InterfaceTheme />,
|
||||
},
|
||||
{
|
||||
];
|
||||
|
||||
if (identityServerEnabled) {
|
||||
data.push({
|
||||
id: "authorized-apps",
|
||||
name: t("OAuth:AuthorizedApps"),
|
||||
content: <AuthorizedApps />,
|
||||
},
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
if (!profile?.isVisitor)
|
||||
data.splice(2, 0, {
|
||||
@ -127,16 +136,21 @@ const SectionBodyContent = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ settingsStore, peopleStore, clientLoadingStore }) => {
|
||||
const { showProfileLoader } = clientLoadingStore;
|
||||
const { targetUser: profile } = peopleStore.targetUserStore;
|
||||
export default inject(
|
||||
({ settingsStore, peopleStore, clientLoadingStore, authStore }) => {
|
||||
const { showProfileLoader } = clientLoadingStore;
|
||||
const { targetUser: profile } = peopleStore.targetUserStore;
|
||||
|
||||
return {
|
||||
profile,
|
||||
currentDeviceType: settingsStore.currentDeviceType,
|
||||
showProfileLoader,
|
||||
};
|
||||
})(
|
||||
const { identityServerEnabled } = authStore.capabilities;
|
||||
|
||||
return {
|
||||
profile,
|
||||
currentDeviceType: settingsStore.currentDeviceType,
|
||||
showProfileLoader,
|
||||
identityServerEnabled,
|
||||
};
|
||||
},
|
||||
)(
|
||||
observer(
|
||||
withTranslation([
|
||||
"Profile",
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"date": "2024628_183746",
|
||||
"date": "202479_153351",
|
||||
"checksums": {
|
||||
"api.js": "0efbae3383bf6c6b6f26d573eee164d2",
|
||||
"api.poly.js": "2a2ac2c0e4a7007b61d2d1ff7b00a22e",
|
||||
"browserDetector.js": "d9387cce805699498e798230a8639c8a",
|
||||
"config.json": "47a314898c8968fab7565d975e0fb828"
|
||||
"config.json": "06a8afc3eb6f63f76dab9b1feb5c459e"
|
||||
}
|
||||
}
|
@ -223,6 +223,7 @@ export type TCapabilities = {
|
||||
ssoLabel: string;
|
||||
oauthEnabled: boolean;
|
||||
ssoUrl: string;
|
||||
identityServerEnabled: boolean;
|
||||
};
|
||||
|
||||
export type TThirdPartyProvider = {
|
||||
|
@ -55,6 +55,8 @@ export const PrivateRoute = (props: PrivateRouteProps) => {
|
||||
restricted,
|
||||
tenantStatus,
|
||||
enablePortalRename,
|
||||
|
||||
identityServerEnabled,
|
||||
} = props;
|
||||
|
||||
const location = useLocation();
|
||||
@ -92,6 +94,11 @@ export const PrivateRoute = (props: PrivateRouteProps) => {
|
||||
location.pathname ===
|
||||
"/portal-settings/customization/general/portal-renaming";
|
||||
|
||||
const isOAuthPage = location.pathname.includes(
|
||||
"portal-settings/developer-tools/oauth",
|
||||
);
|
||||
const isAuthorizedAppsPage = location.pathname.includes("authorized-apps");
|
||||
|
||||
if (isLoaded && !isAuthenticated) {
|
||||
if (isPortalDeactivate) {
|
||||
window.location.replace(
|
||||
@ -218,6 +225,24 @@ export const PrivateRoute = (props: PrivateRouteProps) => {
|
||||
return <Navigate replace to="/error/404" />;
|
||||
}
|
||||
|
||||
if (isOAuthPage && !identityServerEnabled) {
|
||||
return (
|
||||
<Navigate
|
||||
replace
|
||||
to="/portal-settings/developer-tools/javascript-sdk"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (isAuthorizedAppsPage && !identityServerEnabled) {
|
||||
return (
|
||||
<Navigate
|
||||
replace
|
||||
to={location.pathname.replace("authorized-apps", "login")}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
!restricted ||
|
||||
isAdmin ||
|
||||
|
@ -55,6 +55,7 @@ export interface PrivateRouteProps
|
||||
restricted?: boolean;
|
||||
withManager?: boolean;
|
||||
withCollaborator?: boolean;
|
||||
identityServerEnabled?: boolean;
|
||||
}
|
||||
|
||||
export interface PublicRouteProps
|
||||
|
@ -170,7 +170,7 @@ class AuthStore {
|
||||
|
||||
this.skipRequest = skipRequest ?? false;
|
||||
|
||||
await this.settingsStore?.init();
|
||||
await Promise.all([this.settingsStore?.init(), this.getCapabilities()]);
|
||||
|
||||
const requests = [];
|
||||
|
||||
|
@ -335,7 +335,7 @@ class SettingsStore {
|
||||
};
|
||||
|
||||
get ldapSettingsUrl() {
|
||||
//TODO: Change to real link
|
||||
// TODO: Change to real link
|
||||
return `${this.helpLink}/administration/docspace-settings.aspx#LdapSettings_block`;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user