Skip to content

Commit

Permalink
#1709: enable retrieving users by ID
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Sep 13, 2024
1 parent 152a939 commit fbcb9bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion @types/lib/metadataTypes/User.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions lib/metadataTypes/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,15 +602,17 @@ class User extends MetadataType {
},
};
if (key) {
// move original filter down one level into rightOperand and add key filter into leftOperand
let isId = false;
let identifier = key;
if (key.startsWith('id:')) {
identifier = key.slice(3);
isId = true;
}
// remove original filter as it might block this search
requestParams.filter = {
leftOperand: {
leftOperand: 'CustomerKey',
operator: 'equals',
rightOperand: key,
},
operator: 'AND',
rightOperand: requestParams.filter,
leftOperand: isId ? 'AccountUserID' : 'CustomerKey',
operator: 'equals',
rightOperand: identifier,
};
} else {
// if we are not filtering by key the following requests will take long. Warn the user
Expand Down

0 comments on commit fbcb9bb

Please sign in to comment.