sortir connected de baseACL

This commit is contained in:
Maxime Alves LIRMM 2020-07-01 12:05:52 +02:00
parent e60a7ae50e
commit 6b999cdb94
1 changed files with 12 additions and 12 deletions

View File

@ -1,19 +1,19 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
class BaseACL: def connected(func):
""" 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 """ Decorator that checks if the user object of the request has been set
""" """
def caller(): def caller(req, *args, **kwargs):
try: try:
getattr(req.user, 'is_authenticated') getattr(req.user, 'is_authenticated')
return func() return func(req, **kwargs)
except AttributeError: except AttributeError:
return False return False
return caller return caller
class BaseACL:
""" Base ACL class that contains generic methods for domains ACL
"""
def public(self, *args) -> bool: def public(self, *args) -> bool:
"Unlimited access" "Unlimited access"
return True return True