fix: User role was not assigned upon creation (#860)

This commit is contained in:
jbe-dw 2021-01-07 23:07:20 +01:00 committed by GitHub
parent 2917c47fd1
commit 2c18e5c88f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -431,6 +431,7 @@ class User(db.Model):
return {'status': False, 'msg': 'Email address is already in use'}
# first register user will be in Administrator role
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(

View File

@ -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()