Merge branch 'acl_connected'
This commit is contained in:
commit
1a33b51904
|
@ -1,19 +1,19 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
class BaseACL:
|
""" Base ACL module that contains generic functions for domains ACL
|
||||||
""" Base ACL class that contains generic methods for domains ACL
|
"""
|
||||||
"""
|
|
||||||
def connected(req, func):
|
def connected(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
|
||||||
|
|
||||||
def public(self, *args) -> bool:
|
def public(*args, **kwargs) -> bool:
|
||||||
"Unlimited access"
|
"Unlimited access"
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue