feat(auth): support msaas edition for enterprise features

Add msaas to the isEnterprise check alongside ee edition to properly
display enterprise features. Use userStore.isEnterprise in SSOLogin
component instead of directly checking authDetails.edition for
consistent
enterprise status detection.
This commit is contained in:
Shekar Siri 2025-03-19 14:35:11 +01:00
parent 605fa96a34
commit 73fff8b817
2 changed files with 9 additions and 4 deletions

View file

@ -4,6 +4,7 @@ import { Button, Tooltip } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { ENTERPRISE_REQUEIRED } from 'App/constants'; import { ENTERPRISE_REQUEIRED } from 'App/constants';
import stl from './login.module.css'; import stl from './login.module.css';
import { useStore } from 'App/mstore';
interface SSOLoginProps { interface SSOLoginProps {
authDetails: any; authDetails: any;
@ -11,7 +12,9 @@ interface SSOLoginProps {
} }
const SSOLogin = ({ authDetails, enforceSSO = false }: SSOLoginProps) => { const SSOLogin = ({ authDetails, enforceSSO = false }: SSOLoginProps) => {
const { userStore } = useStore();
const { t } = useTranslation(); const { t } = useTranslation();
const { isEnterprise } = userStore;
const getSSOLink = () => const getSSOLink = () =>
window !== window.top window !== window.top
@ -44,7 +47,7 @@ const SSOLogin = ({ authDetails, enforceSSO = false }: SSOLoginProps) => {
<Tooltip <Tooltip
title={ title={
<div className="text-center"> <div className="text-center">
{authDetails.edition === 'ee' ? ( {isEnterprise ? (
<span> <span>
{t('SSO has not been configured.')} {t('SSO has not been configured.')}
<br /> <br />

View file

@ -114,7 +114,9 @@ class UserStore {
get isEnterprise() { get isEnterprise() {
return ( return (
this.account?.edition === 'ee' || this.account?.edition === 'ee' ||
this.authStore.authDetails?.edition === 'ee' this.account?.edition === 'msaas' ||
this.authStore.authDetails?.edition === 'ee' ||
this.authStore.authDetails?.edition === 'msaas'
); );
} }
@ -663,14 +665,14 @@ class AuthStore {
{ {
key: 'authDetails', key: 'authDetails',
serialize: (ad) => { serialize: (ad) => {
delete ad.edition; // delete ad.edition;
return Object.keys(ad).length > 0 return Object.keys(ad).length > 0
? JSON.stringify(ad) ? JSON.stringify(ad)
: JSON.stringify({}); : JSON.stringify({});
}, },
deserialize: (json) => { deserialize: (json) => {
const ad = JSON.parse(json); const ad = JSON.parse(json);
delete ad.edition; // delete ad.edition;
return ad; return ad;
}, },
}, },