def protected_view(*args, **kwargs): access_type = 'read' if request.method == 'GET' else 'write' resource_type = (args[0] if len(args) > 0 else kwargs['resource_type']) if resource_type in [ 'callsets', 'variantsets', 'readgroupsets', 'referencesets', 'variant' ]: ga4gh.view.acquire_client() return view(*args, **kwargs) elif resource_type in [ 'variantset', 'genomes', 'files', 'runs', 'genomes' ]: basespace.view.acquire_client() return view(*args, **kwargs) elif resource_type in RESOURCES: ttam.view.acquire_client() return view(*args, **kwargs) if not verify_access(request, resource_type, access_type): # no access return fhir_error.inform_forbidden() else: # has access # try to acquire a 23andme API client since the request # might be accessing 23andme's API ttam.acquire_client() return view(*args, **kwargs)
def protected_view(*args, **kwargs): access_type = 'read' if request.method == 'GET' else 'write' resource_type = (args[0] if len(args) > 0 else kwargs['resource_type']) if not verify_access(request, resource_type, access_type): # no access return fhir_error.inform_forbidden() else: # has access # try to acquire a 23andme API client since the request # might be accessing 23andme's API ttam.acquire_client() return view(*args, **kwargs)
def protected_view(*args, **kwargs): access_type = "read" if request.method == "GET" else "write" resource_type = args[0] if len(args) > 0 else kwargs["resource_type"] if not verify_access(request, resource_type, access_type): # no access return fhir_error.inform_forbidden() else: # has access # try to acquire a 23andme API client since the request # might be accessing 23andme's API ttam.acquire_client() return view(*args, **kwargs)
def protected_view(*args, **kwargs): access_type = 'read' if request.method == 'GET' else 'write' resource_type = (args[0] if len(args) > 0 else kwargs['resource_type']) if resource_type in ['callsets', 'variantsets', 'readgroupsets', 'referencesets', 'variant']: ga4gh.view.acquire_client() return view(*args, **kwargs) if not verify_access(request, resource_type, access_type): # no access return fhir_error.inform_forbidden() else: # has access # try to acquire a 23andme API client since the request # might be accessing 23andme's API ttam.acquire_client() return view(*args, **kwargs)