code: def check_read_httpauth_access(func):
      
  
      def wrapper(request, *args, **kwargs):
          database_name = kwargs.get('database_name', "")
          collection_name = kwargs.get('collection_name', "")
          if not database_name or not collection_name:
              return HttpResponse(unauthorized_json_response(),
                                  content_type="application/json")
  
          try:
              # Check to see if we have a matching record in DB access.
              dac = HTTPAuthReadAPI.objects.get(
                  database_name=database_name, collection_name=collection_name)
          except HTTPAuthReadAPI.DoesNotExist:
              return HttpResponse(unauthorized_json_response(),
                                  content_type="application/json")
  
          dac_groups = dac.groups.all()
          user_groups = request.user.groups.all()
  
         # allowedgroups
          in_group = False
          group = None
          for dg in dac_groups:
              if dg in user_groups:
                  in_group = True
                  group = dg
  
          if not in_group:
              message = "NOT-IN-GROUP: You do not have access to this collection. Please see your system administrator."
  
              body = {"code": 400,
                      "message": message,
                      "errors": [message, ]}
              return HttpResponse(json.dumps(body, indent=4, ),
                                  content_type="application/json")
  
          # If search keys have been limitied...
          if dac.search_keys:
              search_key_list = shlex.split(dac.search_keys)
              keys = []
              for k in request.GET.keys():
  
                  if k not in search_key_list:
                      message = "Search key %s  is not allowed." % (k)
  
                      body = {"code": 400,
                              "message": k,
                              "errors": [message, ]}
  
                      return HttpResponse(json.dumps(body, indent=4, ),
                                          content_type="application/json")
  
          return func(request, *args, **kwargs)
  
      return update_wrapper(wrapper, func)
docs: Call after login decorator.