fix: remove enterprise mode gating
This commit is contained in:
@@ -11,7 +11,7 @@ const validateSSOLoginParams = to => {
|
||||
return isLoginRoute && hasValidSSOParams;
|
||||
};
|
||||
|
||||
export const validateRouteAccess = (to, next, chatwootConfig = {}) => {
|
||||
export const validateRouteAccess = (to, next) => {
|
||||
// Pages with ignoreSession:true would be rendered
|
||||
// even if there is an active session
|
||||
// Used for confirmation or password reset pages
|
||||
@@ -33,14 +33,7 @@ export const validateRouteAccess = (to, next, chatwootConfig = {}) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable navigation to SAML login if enterprise is not enabled
|
||||
// SAML route has an attribute (requireEnterprise) in it's definition
|
||||
const isEnterpriseOnlyPath =
|
||||
chatwootConfig.isEnterprise !== 'true' &&
|
||||
to.meta &&
|
||||
to.meta.requireEnterprise;
|
||||
|
||||
if (!to.name || isEnterpriseOnlyPath) {
|
||||
if (!to.name) {
|
||||
next(frontendURL('login'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,14 @@ describe('#validateRouteAccess', () => {
|
||||
expect(next).toHaveBeenCalledWith('/app/login');
|
||||
});
|
||||
|
||||
it('allows routes that were previously restricted to enterprise installs', () => {
|
||||
validateRouteAccess(
|
||||
{ name: 'saml_login', meta: { requireEnterprise: true } },
|
||||
next
|
||||
);
|
||||
expect(next).toHaveBeenCalledWith();
|
||||
});
|
||||
|
||||
it('continues to the route in every other case', () => {
|
||||
validateRouteAccess({ name: 'reset_password' }, next);
|
||||
expect(clearBrowserSessionCookies).not.toHaveBeenCalled();
|
||||
|
||||
@@ -17,7 +17,7 @@ export const initalizeRouter = () => {
|
||||
});
|
||||
}
|
||||
|
||||
return validateRouteAccess(to, next, window.chatwootConfig);
|
||||
return validateRouteAccess(to, next);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user