def get_additional_ui_environment(handler): """Gets injected into Jinja and Javascript environment.""" # See config._CONFIG_SCHEMAS for where these paths are defined. if isinstance(handler, ConfigHandler): path = 'imports.cfg' elif isinstance(handler, ui.IPWhitelistsHandler): path = 'ip_whitelist.cfg' elif isinstance(handler, ui.OAuthConfigHandler): path = 'oauth.cfg' else: return {'auth_service_config_locked': config.is_remote_configured()} rev = config.get_config_revision(path) return { 'auth_service_config_locked': config.is_remote_configured(), 'auth_service_config_remote_url': config.get_remote_url(), 'auth_service_config_rev': rev.revision if rev else 'none', 'auth_service_config_url': rev.url if rev else 'about:blank', }
def post(self): if config.is_remote_configured(): self.abort_with_error(409, text='The configuration is managed elsewhere') try: importer.write_config( text=self.parse_body().get('config'), modified_by=auth.get_current_identity()) except ValueError as ex: self.abort_with_error(400, text=str(ex)) self.send_response({'ok': True})
def post(self): if config.is_remote_configured(): self.abort_with_error( 409, text='The configuration is managed elsewhere') try: importer.write_config(text=self.parse_body().get('config'), modified_by=auth.get_current_identity()) except ValueError as ex: self.abort_with_error(400, text=str(ex)) self.send_response({'ok': True})
def get_additional_ui_data(): """Gets injected into Jinja and Javascript environment.""" if not config.is_remote_configured(): return {'auth_service_config_locked': False} config_revisions = {} for path, rev in config.get_revisions().iteritems(): config_revisions[path] = { 'rev': rev.revision if rev else 'none', 'url': rev.url if rev else 'about:blank', } return { 'auth_service_config_locked': True, 'auth_service_configs': { 'remote_url': config.get_remote_url(), 'revisions': config_revisions, }, }
def get(self): if config.is_remote_configured(): success = realms.refetch_config() self.response.set_status(200 if success else 500)
def get(self): if config.is_remote_configured(): config.refetch_config()