import { StoreNav , StoreUserContext } from './stores' ; import cfg from 'teleport/config' ; import * as types from './types' ; import AuditService from './services/audit' ; import RecordingsService from './services/recordings' ; import nodeService from './services/nodes' ; import clusterService from './services/clusters' ; import sshService from './services/ssh' ; import ResourceService from './services/resources' ; import userService from './services/user' ; import appService from './services/apps' ; import KubeService from './services/kube' ; import DatabaseService from './services/databases' ; import DesktopService from './services/desktops' ; import MfaService from './services/mfa' ; class TeleportContext implements types . Context { storeNav = new StoreNav ( ) ; storeUser = new StoreUserContext ( ) ; features : types . Feature [ ] = [ ] ; auditService = new AuditService ( ) ; recordingsService = new RecordingsService ( ) ; nodeService = nodeService ; clusterService = clusterService ; sshService = sshService ; resourceService = new ResourceService ( ) ; userService = userService ; appService = appService ; kubeService = new KubeService ( ) ; databaseService = new DatabaseService ( ) ; desktopService = new DesktopService ( ) ; mfaService = new MfaService ( ) ; isEnterprise = cfg . isEnterprise ; init ( ) { return userService . fetchUserContext ( ) . then ( user => { this . storeUser . setState ( user ) ; } ) ; } getFeatureFlags ( ) { const userContext = this . storeUser ; return { audit : userContext . getEventAccess ( ) . list , recordings : userContext . getSessionsAccess ( ) . list , authConnector : userContext . getConnectorAccess ( ) . list , roles : userContext . getRoleAccess ( ) . list , trustedClusters : userContext . getTrustedClusterAccess ( ) . list , users : userContext . getUserAccess ( ) . list , applications : userContext . getAppServerAccess ( ) . list , kubernetes : userContext . getKubeServerAccess ( ) . list , billing : userContext . getBillingAccess ( ) . list , databases : userContext . getDatabaseAccess ( ) . list , desktops : userContext . getDesktopAccess ( ) . list , } ; } } export default TeleportContext ;