reformatting
This commit is contained in:
parent
d0f093ac16
commit
e0bbe02bc1
|
@ -172,11 +172,13 @@ def demote_admin(username):
|
|||
flash(f"Ungültiger Nutzer {username}")
|
||||
return redirect('/manage_admins')
|
||||
if user.has_role('super_admin'):
|
||||
flash(f'Benutzer {username} hat Super-Admin-Rechte und kann nicht verändert werden!')
|
||||
flash(f'Benutzer {username} hat Super-Admin-Rechte und kann nicht '
|
||||
'verändert werden!')
|
||||
return redirect('/manage_admins')
|
||||
if user.has_role('admin'):
|
||||
security.datastore.remove_role_from_user(user, 'admin')
|
||||
current_app.logger.info(f"Super admin {current_user.username} revoked admin privileges of user {username}")
|
||||
current_app.logger.info(f"Super admin {current_user.username} revoked "
|
||||
f"admin privileges of user {username}")
|
||||
db.session.commit()
|
||||
else:
|
||||
flash(f'Benutzer {username} ist bereits kein Admin!')
|
||||
|
@ -188,7 +190,8 @@ def demote_admin(username):
|
|||
def backup_user_datastore():
|
||||
# get list of defined admin users for backup
|
||||
users = security.datastore.user_model.query.all()
|
||||
user_data = [{'username': u.username, 'email': u.email, 'active': u.is_active, 'password_hash': u.password,
|
||||
user_data = [{'username': u.username, 'email': u.email,
|
||||
'active': u.is_active, 'password_hash': u.password,
|
||||
'roles': [r.name for r in u.roles]}
|
||||
for u in users if not u.has_role('super_admin')]
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user