Skip to content

Commit

Permalink
users: remove Flask user
Browse files Browse the repository at this point in the history
* removes Flask user when an user record is deleted.
* Closes #491.

Co-Authored-by: Sébastien Délèze <[email protected]>
  • Loading branch information
Sébastien Délèze committed Feb 23, 2021
1 parent 64ecc48 commit 58437fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sonar/modules/users/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ def delete(self, force=False, dbcommit=True, delindex=False):
# Remove roles from user account.
self.remove_roles()

# Deactivate account.
datastore.deactivate_user(self.user)
# Delete account.
datastore.delete_user(self.user)

return super(UserRecord, self).delete(force=force,
dbcommit=dbcommit,
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/users/test_users_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ def test_delete(app, admin):
with app.app_context():
datastore = app.extensions['security'].datastore
user = datastore.find_user(email='[email protected]')
assert not user.roles
assert not user.is_active
assert not user


def test_update(app, admin, roles):
Expand Down

0 comments on commit 58437fd

Please sign in to comment.