diff --git a/halfapi/acl.py b/halfapi/acl.py index 946e3ed..32b83c6 100644 --- a/halfapi/acl.py +++ b/halfapi/acl.py @@ -1,19 +1,19 @@ #!/usr/bin/env python3 +def connected(func): + """ Decorator that checks if the user object of the request has been set + """ + def caller(req, *args, **kwargs): + try: + getattr(req.user, 'is_authenticated') + return func(req, **kwargs) + except AttributeError: + return False + + return caller + class BaseACL: """ Base ACL class that contains generic methods for domains ACL """ - def connected(req, func): - """ Decorator that checks if the user object of the request has been set - """ - def caller(): - try: - getattr(req.user, 'is_authenticated') - return func() - except AttributeError: - return False - - return caller - def public(self, *args) -> bool: "Unlimited access" return True