Skip to content

Commit

Permalink
fix: delete users that were never activated (LAN-847)
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra committed Aug 31, 2024
1 parent 67f93b5 commit e8efee1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions landa/organization_management/user/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ def delete_or_disable_inactive_users():
pluck="name",
)

users_to_delete += frappe.get_all(
"User",
filters=[
["last_active", "is", "not set"],
["creation", "<", cutoff_date],
["name", "not in", STANDARD_USERS],
],
pluck="name",
)

assert getdate(cutoff_date).year <= datetime.now().year - 1
assert (
len(users_to_delete) / frappe.db.count("User", filters={"name": ("not in", STANDARD_USERS)})
Expand Down

0 comments on commit e8efee1

Please sign in to comment.