Commit 945f9364 authored by Jean-Baptiste Pasquier's avatar Jean-Baptiste Pasquier

fix: add get_client_ip

parent 7f62f7c3
Pipeline #7027 passed with stage
in 27 seconds
......@@ -2,6 +2,15 @@ from djangoldp.permissions import LDPPermissions
from django.db.models.base import ModelBase
def get_client_ip(request):
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
if x_forwarded_for:
ip = x_forwarded_for.split(',')[0]
ip = request.META.get('REMOTE_ADDR')
return ip
class ProjectPermissions(LDPPermissions):
def user_permissions(self, user, obj_or_model, obj=None):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment