mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-01-07 10:55:40 +00:00
Use display name of role
This commit is contained in:
parent
08de197cff
commit
334878d75d
10
app/views.py
10
app/views.py
@ -344,9 +344,8 @@ def saml_authorized():
|
|||||||
elif admin_group_name in user_groups:
|
elif admin_group_name in user_groups:
|
||||||
uplift_to_admin(user)
|
uplift_to_admin(user)
|
||||||
elif admin_attribute_name or group_attribute_name:
|
elif admin_attribute_name or group_attribute_name:
|
||||||
user_role = Role.query.filter_by(name='User').first().id
|
if user.role.name != 'User':
|
||||||
if user.role_id != user_role:
|
user.role_id = Role.query.filter_by(name='User').first().id
|
||||||
user.role_id = user_role
|
|
||||||
history = History(msg='Demoting {0} to user'.format(user.username), created_by='SAML Assertion')
|
history = History(msg='Demoting {0} to user'.format(user.username), created_by='SAML Assertion')
|
||||||
history.add()
|
history.add()
|
||||||
user.plain_text_password = None
|
user.plain_text_password = None
|
||||||
@ -381,9 +380,8 @@ def handle_account(account_name):
|
|||||||
|
|
||||||
|
|
||||||
def uplift_to_admin(user):
|
def uplift_to_admin(user):
|
||||||
admin_role = Role.query.filter_by(name='Administrator').first().id
|
if user.role.name != 'Administrator':
|
||||||
if user.role_id != admin_role:
|
user.role_id = Role.query.filter_by(name='Administrator').first().id
|
||||||
user.role_id = admin_role
|
|
||||||
history = History(msg='Promoting {0} to administrator'.format(user.username), created_by='SAML Assertion')
|
history = History(msg='Promoting {0} to administrator'.format(user.username), created_by='SAML Assertion')
|
||||||
history.add()
|
history.add()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user