diff --git a/djangoldp_account/filters.py b/djangoldp_account/filters.py index d0ff0dbd4246c3332a345bad5ab04a42f883dbe0..7f8ac41f34fcab236481de74410be93d31d17d2d 100644 --- a/djangoldp_account/filters.py +++ b/djangoldp_account/filters.py @@ -6,7 +6,7 @@ PASSTHROUGH_IPS = getattr(settings, 'PASSTHROUGH_IPS', '') def check_client_ip(request): x_forwarded_for = request.headers.get('x-forwarded-for') if x_forwarded_for: - if any(i in x_forwarded_for.replace(' ', '').split(',') for i in PASSTHROUGH_IPS): + if any(ip in x_forwarded_for.replace(' ', '').split(',') for ip in PASSTHROUGH_IPS): return True elif request.META.get('REMOTE_ADDR') in PASSTHROUGH_IPS: return True diff --git a/djangoldp_account/permissions.py b/djangoldp_account/permissions.py index c0cbe00382dff6030ec7fae33ea771d39d47b1e1..6cde9a10bd79f8e14084ad81adf5f39341f8849c 100644 --- a/djangoldp_account/permissions.py +++ b/djangoldp_account/permissions.py @@ -7,4 +7,8 @@ class IPOpenPermissions(LDPBasePermission): return check_client_ip(request) def has_object_permission(self, request, view, obj): - return check_client_ip(request) \ No newline at end of file + return check_client_ip(request) + + def get_permissions(self, user, model, obj=None): + #Will always say there is no migrations, not taking the IP into accounts + return set() \ No newline at end of file diff --git a/djangoldp_account/tests/tests_update.py b/djangoldp_account/tests/tests_update.py index bef4f115e73675a657963384788e5b577b37a695..6e62f32fb607fb7876b9f5bc7409a85e66ab26c5 100644 --- a/djangoldp_account/tests/tests_update.py +++ b/djangoldp_account/tests/tests_update.py @@ -23,15 +23,7 @@ class UpdateTestCase(APITestCase): test_picture = "https://github.com/" + urllib.parse.quote("calummackervoy/calummackervoy.github.io/blob/master/assets/img/profile.jpg") payload = { - "@context": {"@vocab": "http://happy-dev.fr/owl/#", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "ldp": "http://www.w3.org/ns/ldp#", - "foaf": "http://xmlns.com/foaf/0.1/", "name": "rdfs:label", - "acl": "http://www.w3.org/ns/auth/acl#", "permissions": "acl:accessControl", - "mode": "acl:mode", "geo": "http://www.w3.org/2003/01/geo/wgs84_pos#", "lat": "geo:lat", - "lng": "geo:long", "entrepreneurProfile": "http://happy-dev.fr/owl/#entrepreneur_profile", - "mentorProfile": "http://happy-dev.fr/owl/#mentor_profile", "account": "hd:account", - "messageSet": "http://happy-dev.fr/owl/#message_set", - "author": "http://happy-dev.fr/owl/#author_user", "title": "http://happy-dev.fr/owl/#title"}, + "@context": {"@vocab": "https://cdn.startinblox.com/owl#"}, '@id': settings.SITE_URL + "/accounts/{}/".format(self.user.account.slug), 'picture': test_picture, 'slug': self.user.slug