allow users to remove domain (#952)

This commit is contained in:
steschuser
2021-10-30 21:21:45 +02:00
committed by GitHub
parent 1f34dbf810
commit bf83662108
6 changed files with 211 additions and 2 deletions

View File

@ -93,6 +93,23 @@ def can_configure_dnssec(f):
return decorated_function
def can_remove_domain(f):
"""
Grant access if:
- user is in Operator role or higher, or
- allow_user_remove_domain is on
"""
@wraps(f)
def decorated_function(*args, **kwargs):
if current_user.role.name not in [
'Administrator', 'Operator'
] and not Setting().get('allow_user_remove_domain'):
abort(403)
return f(*args, **kwargs)
return decorated_function
def can_create_domain(f):
"""