From 6b999cdb94a4c8d0921ff3474a39a45ebb0653e0 Mon Sep 17 00:00:00 2001 From: Maxime Alves LIRMM Date: Wed, 1 Jul 2020 12:05:52 +0200 Subject: [PATCH] sortir connected de baseACL --- halfapi/acl.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) 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