Skip to content

Commit

Permalink
Merge pull request #5834 from Countly/delete_old_members_gc_v2
Browse files Browse the repository at this point in the history
Update delete_old_members.js for global admins to be exluded from deletion
  • Loading branch information
Cookiezaurs authored Dec 4, 2024
2 parents a30812c + 69fc7bd commit 04027a8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/scripts/member-managament/delete_old_members.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ var days = 30;
//query states not logged in in last N days , but logged in at least once

var ts = Math.round(Date.now() / 1000) - days * 24 * 60 * 60;
var query = {"$and": [{"last_login": {"$lt": ts}}, {"last_login": {"$exists": true}}]};
var query = {"$and": [{"last_login": {"$lt": ts}}, {"last_login": {"$exists": true}}, {"global_admin": {"$ne": true}}]};
// {"global_admin": {"$ne": true}} ensures that global admins are excluded from deletion.

//although mogodb does not return null on $lt, keep like above for safety

Expand Down Expand Up @@ -120,4 +121,4 @@ function sendRequest(params, callback) {
console.log(e);
callback({"err": 'Failed to send'});
}
}
}

0 comments on commit 04027a8

Please sign in to comment.