Skip to content

Commit

Permalink
Merge pull request #4910 from Countly/SER-1126-non-persistent-member-…
Browse files Browse the repository at this point in the history
…id-after-ad-ldap-login

[SER-1126] updateMember update to ensure permanent _id field in members collection
  • Loading branch information
coskunaydinoglu authored Mar 7, 2024
2 parents c88ffb6 + 5e8cfa1 commit 0a61bcf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frontend/express/libs/members.js
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,13 @@ membersUtility.updateMember = async function(query = {}, data = {}, upsert = tru
catch (ex) {
return reject(ex);
}
delete copy._id; // update on the path '_id' would modify the immutable field '_id'

// _id and api_key are immutable(unique fields. They should not be updated)
// created_at is set on user creation and should not be updated)
delete copy._id;
delete copy.api_key;
delete copy.created_at;

this.db.collection('members').update(query, { $set: copy }, { upsert }, (err) => {
if (err) {
reject(err);
Expand Down

0 comments on commit 0a61bcf

Please sign in to comment.