sortir connected de baseACL
This commit is contained in:
parent
e60a7ae50e
commit
6b999cdb94
|
@ -1,19 +1,19 @@
|
||||||
#!/usr/bin/env python3
|
#!/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:
|
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"
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue