ajout du decorateur "connected"
This commit is contained in:
parent
bb1e2503ae
commit
a719b4a31a
|
@ -2,6 +2,17 @@
|
||||||
class BaseACL:
|
class BaseACL:
|
||||||
""" Base ACL class that contains generic methods for domains ACL
|
""" 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:
|
def public(self, *args) -> bool:
|
||||||
"Unlimited access"
|
"Unlimited access"
|
||||||
|
|
Loading…
Reference in New Issue