Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #13 from postatum/92826890_cant_disable_auth
Browse files Browse the repository at this point in the history
Check auth is enabled before setting public limits
  • Loading branch information
jstoiko committed Apr 27, 2015
2 parents 5092b00 + 8231400 commit 4bb2d74
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nefertari/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,15 @@ def __init__(self, context, request, _params={}):

self.setup_default_wrappers()
self.convert_ids2objects()
self.set_public_limits()

if not getattr(self.request, 'user', None):
def set_public_limits(self):
""" Set public limits if auth is enabled and user is not
authenticated.
"""
root_resource = getattr(self, 'root_resource', None)
auth_enabled = root_resource is not None and root_resource.auth
if auth_enabled and not getattr(self.request, 'user', None):
wrappers.set_public_limits(self)

def convert_ids2objects(self):
Expand Down

0 comments on commit 4bb2d74

Please sign in to comment.