def get(): """Search orgs.""" # Search based on request arguments business_identifier = request.args.get('affiliation', None) name = request.args.get('name', None) org_type = request.args.get('type', None) try: response, status = OrgService.search_orgs(business_identifier=business_identifier, org_type=org_type, name=name), \ http_status.HTTP_200_OK # TODO change it later # If searching by name return 200 with empty results if orgs exist # Else return 204 if name: if response and response.get('orgs'): status = http_status.HTTP_200_OK else: status = http_status.HTTP_204_NO_CONTENT response = {} # Do not return any results if searching by name except BusinessException as exception: response, status = { 'code': exception.code, 'message': exception.message }, exception.status_code return response, status
def get(): """Search orgs.""" # Search based on request arguments business_identifier = request.args.get('affiliation', None) org_type = request.args.get('type', None) try: response, status = OrgService.search_orgs(business_identifier=business_identifier, org_type=org_type), \ http_status.HTTP_200_OK except BusinessException as exception: response, status = {'code': exception.code, 'message': exception.message}, exception.status_code return response, status
def get(): """Search orgs.""" # Search based on request arguments business_identifier = request.args.get('affiliation', None) name = request.args.get('name', None) statuses = request.args.getlist('status', None) access_type = request.args.get('access_type', None) bcol_account_id = request.args.get('bcolAccountId', None) page = request.args.get('page', 1) limit = request.args.get('limit', 10) validate_name = request.args.get('validateName', 'False') try: token = g.jwt_oidc_token_info if validate_name.upper() == 'TRUE': response, status = OrgService.find_by_org_name( name), http_status.HTTP_200_OK else: response, status = OrgService.search_orgs( business_identifier=business_identifier, access_type=access_type, name=name, statuses=statuses, bcol_account_id=bcol_account_id, page=page, limit=limit, token=token), http_status.HTTP_200_OK # If public user is searching , return 200 with empty results if orgs exist # Else return 204 is_public_user = Role.PUBLIC_USER.value in token.get( 'realm_access').get('roles') if is_public_user: # public user cant get the details in search.Gets only status of orgs if response and response.get('orgs'): status = http_status.HTTP_200_OK else: status = http_status.HTTP_204_NO_CONTENT response = {} # Do not return any results if searching by name except BusinessException as exception: response, status = { 'code': exception.code, 'message': exception.message }, exception.status_code return response, status
def get(): """Search orgs.""" org_search = OrgSearch(request.args.get('name', None), request.args.get('branchName', None), request.args.get('affiliation', None), request.args.getlist('status', None), request.args.getlist('accessType', None), request.args.get('bcolAccountId', None), request.args.get('id', None), request.args.get('decisionMadeBy', None), request.args.get('orgType', None), int(request.args.get('page', 1)), int(request.args.get('limit', 10))) validate_name = request.args.get('validateName', 'False') try: token = g.jwt_oidc_token_info if validate_name.upper() == 'TRUE': response, status = OrgService.find_by_org_name(org_name=org_search.name, branch_name=org_search.branch_name), \ http_status.HTTP_200_OK else: response, status = OrgService.search_orgs( org_search), http_status.HTTP_200_OK is_public_user = Role.PUBLIC_USER.value in token.get( 'realm_access').get('roles') if is_public_user: # public user cant get the details in search.Gets only status of orgs if response and response.get('orgs'): status = http_status.HTTP_200_OK else: status = http_status.HTTP_204_NO_CONTENT response = {} # Do not return any results if searching by name except BusinessException as exception: response, status = { 'code': exception.code, 'message': exception.message }, exception.status_code return response, status