def history(item): return api.history( request=build_oidc_request(request, group_attribute), key=partition_key, value=item, query_params=parse_query_params(request.query_string), actions=history_actions )
def audit(item): search_params = {} if item: search_params = {f'resource.{partition_key}': item} return api.list_audit_logs( request=build_oidc_request(request, group_attribute), search_params=search_params, query_params=parse_query_params(request.query_string) )
def check_user_permissions(): if 'method' not in request.data or 'path' not in request.data: raise ParseError("Body should contain 'method' and 'path' keys") return { 'authorized': api.can_access_endpoint( method=request.data['method'], path=request.data['path'], request=build_oidc_request(request, group_attribute) ) }
def search(search_key): return api.search( request=build_oidc_request(request, group_attribute), key=search_key, values=request.data )
def list_items(): return api.list_table( request=build_oidc_request(request, group_attribute), query_params=parse_query_params(request.query_string) )
def create_item(): """Create an item""" return api.create(request=build_oidc_request(request, 'groups'), item=request.data)