Exemple #1
0
 def loadAuth(cls):
     # Getting username from Auth profile for token
     if cls.token:
         authServiceUrl = cls.cfg['auth-service-url']
         auth_client = _KBaseAuth(authServiceUrl)
         cls.user_id = auth_client.get_user(cls.token)
     else:
         cls.user_id = None
 def newAuth(self, token):
     # Getting username from Auth profile for token
     if token:
         authServiceUrl = self.cfg['auth-service-url']
         auth_client = _KBaseAuth(authServiceUrl)
         user_id = auth_client.get_user(token)
     else:
         user_id = None
     return user_id
 def __init__(self):
     submod = config.get_service_name() or 'JobBrowserBFF'
     self.userlog = log.log(
         submod, ip_address=True, authuser=True, module=True, method=True,
         call_id=True, changecallback=self.logcallback,
         config=config.get_config_file())
     self.serverlog = log.log(
         submod, ip_address=True, authuser=True, module=True, method=True,
         call_id=True, logfile=self.userlog.get_log_file())
     self.serverlog.set_log_level(6)
     self.rpc_service = JSONRPCServiceCustom()
     self.method_authentication = dict()
     self.rpc_service.add(impl_JobBrowserBFF.get_jobs,
                          name='JobBrowserBFF.get_jobs')
     self.method_authentication['JobBrowserBFF.get_jobs'] = 'required'  # noqa
     self.rpc_service.add(impl_JobBrowserBFF.query_jobs,
                          name='JobBrowserBFF.query_jobs')
     self.method_authentication['JobBrowserBFF.query_jobs'] = 'required'  # noqa
     self.rpc_service.add(impl_JobBrowserBFF.get_job_log,
                          name='JobBrowserBFF.get_job_log')
     self.method_authentication['JobBrowserBFF.get_job_log'] = 'required'  # noqa
     self.rpc_service.add(impl_JobBrowserBFF.cancel_job,
                          name='JobBrowserBFF.cancel_job')
     self.method_authentication['JobBrowserBFF.cancel_job'] = 'required'  # noqa
     self.rpc_service.add(impl_JobBrowserBFF.get_job_types,
                          name='JobBrowserBFF.get_job_types')
     self.method_authentication['JobBrowserBFF.get_job_types'] = 'required'  # noqa
     self.rpc_service.add(impl_JobBrowserBFF.get_job_states,
                          name='JobBrowserBFF.get_job_states')
     self.method_authentication['JobBrowserBFF.get_job_states'] = 'required'  # noqa
     self.rpc_service.add(impl_JobBrowserBFF.get_client_groups,
                          name='JobBrowserBFF.get_client_groups')
     self.method_authentication['JobBrowserBFF.get_client_groups'] = 'required'  # noqa
     self.rpc_service.add(impl_JobBrowserBFF.get_searchable_job_fields,
                          name='JobBrowserBFF.get_searchable_job_fields')
     self.method_authentication['JobBrowserBFF.get_searchable_job_fields'] = 'required'  # noqa
     self.rpc_service.add(impl_JobBrowserBFF.get_sort_specs,
                          name='JobBrowserBFF.get_sort_specs')
     self.method_authentication['JobBrowserBFF.get_sort_specs'] = 'required'  # noqa
     self.rpc_service.add(impl_JobBrowserBFF.get_log_levels,
                          name='JobBrowserBFF.get_log_levels')
     self.method_authentication['JobBrowserBFF.get_log_levels'] = 'required'  # noqa
     self.rpc_service.add(impl_JobBrowserBFF.is_admin,
                          name='JobBrowserBFF.is_admin')
     self.method_authentication['JobBrowserBFF.is_admin'] = 'required'  # noqa
     self.rpc_service.add(impl_JobBrowserBFF.status,
                          name='JobBrowserBFF.status')
     authurl = config.get(AUTH) if config else None
     self.auth_client = _KBaseAuth(authurl)