MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / __call__

Method __call__

api/core/middleware/admin.py:15–26  ·  view source on GitHub ↗
(self, request)

Source from the content-addressed store, hash-verified

13 self.get_response = get_response
14
15 def __call__(self, request): # type: ignore[no-untyped-def]
16 if request.path.startswith("/admin"):
17 ip = get_ip_address_from_request(request)
18 if (
19 settings.ALLOWED_ADMIN_IP_ADDRESSES
20 and ip not in settings.ALLOWED_ADMIN_IP_ADDRESSES
21 ):
22 # IP address not allowed!
23 logger.info("Denying access to admin for ip address %s" % ip)
24 raise PermissionDenied()
25
26 return self.get_response(request)

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected