fix: [delete user] remove user from org

This commit is contained in:
terrtia 2024-09-17 15:10:43 +02:00
parent ba61d1ae69
commit 6509b5d732
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -586,6 +586,10 @@ class AILUser(UserMixin):
user_token = self.get_api_key() user_token = self.get_api_key()
if user_token: if user_token:
r_serv_db.hdel('ail:users:tokens', user_token) r_serv_db.hdel('ail:users:tokens', user_token)
user_org = self.get_org()
if user_org:
org = ail_orgs.Organisation(user_org)
org.remove_user(self.user_id)
r_serv_db.delete(f'ail:user:metadata:{self.user_id}') r_serv_db.delete(f'ail:user:metadata:{self.user_id}')
r_serv_db.hdel('ail:users:all', self.user_id) r_serv_db.hdel('ail:users:all', self.user_id)