mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 14:40:27 +00:00
fix: User role was not assigned upon creation (#860)
This commit is contained in:
parent
2917c47fd1
commit
2c18e5c88f
@ -431,7 +431,8 @@ class User(db.Model):
|
||||
return {'status': False, 'msg': 'Email address is already in use'}
|
||||
|
||||
# first register user will be in Administrator role
|
||||
self.role_id = Role.query.filter_by(name='User').first().id
|
||||
if self.role_id is None:
|
||||
self.role_id = Role.query.filter_by(name='User').first().id
|
||||
if User.query.count() == 0:
|
||||
self.role_id = Role.query.filter_by(
|
||||
name='Administrator').first().id
|
||||
|
@ -845,7 +845,7 @@ def api_add_account_user(account_id, user_id):
|
||||
user.username, account.name))
|
||||
|
||||
history = History(
|
||||
msg='Revoke {} user privileges on {}'.format(
|
||||
msg='Add {} user privileges on {}'.format(
|
||||
user.username, account.name),
|
||||
created_by=current_user.username)
|
||||
history.add()
|
||||
|
Loading…
Reference in New Issue
Block a user