mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 14:40:27 +00:00
bg_domain button for operators and higher
This commit is contained in:
parent
993e02b635
commit
10dc2b0273
@ -3,6 +3,7 @@ from flask import Blueprint, render_template, url_for, current_app, request, jso
|
||||
from flask_login import login_required, current_user, login_manager
|
||||
from sqlalchemy import not_
|
||||
|
||||
from ..decorators import operator_role_required
|
||||
from ..lib.utils import customBoxes
|
||||
from ..models.user import User, Anonymous
|
||||
from ..models.account import Account
|
||||
@ -150,6 +151,10 @@ def dashboard():
|
||||
else:
|
||||
current_app.logger.info('Updating domains in background...')
|
||||
|
||||
show_bg_domain_button = BG_DOMAIN_UPDATE
|
||||
if BG_DOMAIN_UPDATE and current_user.role.name not in ['Administrator', 'Operator']:
|
||||
show_bg_domain_button = False
|
||||
|
||||
# Stats for dashboard
|
||||
domain_count = 0
|
||||
history_number = 0
|
||||
@ -198,12 +203,13 @@ def dashboard():
|
||||
history_number=history_number,
|
||||
uptime=uptime,
|
||||
histories=history,
|
||||
show_bg_domain_button=BG_DOMAIN_UPDATE,
|
||||
show_bg_domain_button=show_bg_domain_button,
|
||||
pdns_version=Setting().get('pdns_version'))
|
||||
|
||||
|
||||
@dashboard_bp.route('/domains-updater', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@operator_role_required
|
||||
def domains_updater():
|
||||
current_app.logger.debug('Update domains in background')
|
||||
d = Domain().update()
|
||||
|
Loading…
Reference in New Issue
Block a user