chore: move config behind checks (#1211)
This commit is contained in:
@@ -17,7 +17,7 @@ import login from './mutations/login';
|
|||||||
import registerUser from './mutations/register-user.ee';
|
import registerUser from './mutations/register-user.ee';
|
||||||
import resetConnection from './mutations/reset-connection';
|
import resetConnection from './mutations/reset-connection';
|
||||||
import resetPassword from './mutations/reset-password.ee';
|
import resetPassword from './mutations/reset-password.ee';
|
||||||
import updateConfig from './mutations/update-config';
|
import updateConfig from './mutations/update-config.ee';
|
||||||
import updateConnection from './mutations/update-connection';
|
import updateConnection from './mutations/update-connection';
|
||||||
import updateCurrentUser from './mutations/update-current-user';
|
import updateCurrentUser from './mutations/update-current-user';
|
||||||
import updateFlow from './mutations/update-flow';
|
import updateFlow from './mutations/update-flow';
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import Context from '../../types/express/context';
|
import { hasValidLicense } from '../../helpers/license.ee';
|
||||||
import Config from '../../models/config';
|
import Config from '../../models/config';
|
||||||
|
import Context from '../../types/express/context';
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
keys: string[];
|
keys: string[];
|
||||||
@@ -10,6 +11,8 @@ const getConfig = async (
|
|||||||
params: Params,
|
params: Params,
|
||||||
context: Context
|
context: Context
|
||||||
) => {
|
) => {
|
||||||
|
if (!await hasValidLicense()) return {};
|
||||||
|
|
||||||
const configQuery = Config
|
const configQuery = Config
|
||||||
.query();
|
.query();
|
||||||
|
|
@@ -3,7 +3,7 @@ import getApps from './queries/get-apps';
|
|||||||
import getAutomatischInfo from './queries/get-automatisch-info';
|
import getAutomatischInfo from './queries/get-automatisch-info';
|
||||||
import getBillingAndUsage from './queries/get-billing-and-usage.ee';
|
import getBillingAndUsage from './queries/get-billing-and-usage.ee';
|
||||||
import getConnectedApps from './queries/get-connected-apps';
|
import getConnectedApps from './queries/get-connected-apps';
|
||||||
import getConfig from './queries/get-config';
|
import getConfig from './queries/get-config.ee';
|
||||||
import getCurrentUser from './queries/get-current-user';
|
import getCurrentUser from './queries/get-current-user';
|
||||||
import getDynamicData from './queries/get-dynamic-data';
|
import getDynamicData from './queries/get-dynamic-data';
|
||||||
import getDynamicFields from './queries/get-dynamic-fields';
|
import getDynamicFields from './queries/get-dynamic-fields';
|
||||||
|
@@ -293,11 +293,13 @@ class User extends Base {
|
|||||||
|
|
||||||
if (Array.isArray(this.permissions)) {
|
if (Array.isArray(this.permissions)) {
|
||||||
this.permissions = this.permissions.filter((permission) => {
|
this.permissions = this.permissions.filter((permission) => {
|
||||||
const isRolePermission = permission.subject === 'Role';
|
const restrictedSubjects = [
|
||||||
const isSamlAuthProviderPermission =
|
'Role',
|
||||||
permission.subject === 'SamlAuthProvider';
|
'SamlAuthProvider',
|
||||||
|
'Config',
|
||||||
|
];
|
||||||
|
|
||||||
return !isRolePermission && !isSamlAuthProviderPermission;
|
return !restrictedSubjects.includes(permission.subject);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { useQuery } from '@apollo/client';
|
import { useQuery } from '@apollo/client';
|
||||||
import { IJSONObject } from '@automatisch/types';
|
import { IJSONObject } from '@automatisch/types';
|
||||||
|
|
||||||
import { GET_CONFIG } from 'graphql/queries/get-config';
|
import { GET_CONFIG } from 'graphql/queries/get-config.ee';
|
||||||
|
|
||||||
type QueryResponse = {
|
type QueryResponse = {
|
||||||
getConfig: IJSONObject;
|
getConfig: IJSONObject;
|
||||||
|
Reference in New Issue
Block a user