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 resetConnection from './mutations/reset-connection';
|
||||
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 updateCurrentUser from './mutations/update-current-user';
|
||||
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 Context from '../../types/express/context';
|
||||
|
||||
type Params = {
|
||||
keys: string[];
|
||||
@@ -10,6 +11,8 @@ const getConfig = async (
|
||||
params: Params,
|
||||
context: Context
|
||||
) => {
|
||||
if (!await hasValidLicense()) return {};
|
||||
|
||||
const configQuery = Config
|
||||
.query();
|
||||
|
@@ -3,7 +3,7 @@ import getApps from './queries/get-apps';
|
||||
import getAutomatischInfo from './queries/get-automatisch-info';
|
||||
import getBillingAndUsage from './queries/get-billing-and-usage.ee';
|
||||
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 getDynamicData from './queries/get-dynamic-data';
|
||||
import getDynamicFields from './queries/get-dynamic-fields';
|
||||
|
@@ -293,11 +293,13 @@ class User extends Base {
|
||||
|
||||
if (Array.isArray(this.permissions)) {
|
||||
this.permissions = this.permissions.filter((permission) => {
|
||||
const isRolePermission = permission.subject === 'Role';
|
||||
const isSamlAuthProviderPermission =
|
||||
permission.subject === 'SamlAuthProvider';
|
||||
const restrictedSubjects = [
|
||||
'Role',
|
||||
'SamlAuthProvider',
|
||||
'Config',
|
||||
];
|
||||
|
||||
return !isRolePermission && !isSamlAuthProviderPermission;
|
||||
return !restrictedSubjects.includes(permission.subject);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { useQuery } from '@apollo/client';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { GET_CONFIG } from 'graphql/queries/get-config';
|
||||
import { GET_CONFIG } from 'graphql/queries/get-config.ee';
|
||||
|
||||
type QueryResponse = {
|
||||
getConfig: IJSONObject;
|
||||
|
Reference in New Issue
Block a user