1
0
forked from ScoDoc/ScoDoc

anonymize_users: ignore admin

This commit is contained in:
Emmanuel Viennet 2024-04-12 01:04:27 +02:00
parent beba69bfe4
commit cbe85dfb7d

View File

@ -157,7 +157,7 @@ def anonymize_users(cursor):
cursor.execute("""UPDATE "user" SET token = NULL;""") cursor.execute("""UPDATE "user" SET token = NULL;""")
cursor.execute("""UPDATE "user" SET token_expiration = NULL;""") cursor.execute("""UPDATE "user" SET token_expiration = NULL;""")
# Change les noms/prenoms/mail # Change les noms/prenoms/mail
cursor.execute("""SELECT * FROM "user";""") cursor.execute("""SELECT * FROM "user" WHERE user_name <> 'admin';""")
users = cursor.fetchall() # fetch tout car modifie cette table ds la boucle users = cursor.fetchall() # fetch tout car modifie cette table ds la boucle
nb_users = len(users) nb_users = len(users)
used_user_names = {u["user_name"] for u in users} used_user_names = {u["user_name"] for u in users}