Use !== false for safer disabled user filtering
The === true check would silently drop all users if accountEnabled is not in the API response (e.g. if the default projection omits it). The !== false check is safer: it only filters users that are explicitly disabled, and passes through users with unset accountEnabled (same as pre-v1.51.0 behavior). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -384,7 +384,7 @@ describe('read microsoft graph', () => {
|
||||
});
|
||||
|
||||
const names = users.map(u => u.metadata.name);
|
||||
expect(names).toEqual(['enabled_example.com']);
|
||||
expect(names).toEqual(['enabled_example.com', 'unset_example.com']);
|
||||
});
|
||||
|
||||
it('should include accountEnabled in select when userSelect is set', async () => {
|
||||
|
||||
@@ -63,7 +63,7 @@ async function* filterDisabledUsers(
|
||||
users: AsyncIterable<MicrosoftGraph.User>,
|
||||
): AsyncIterable<MicrosoftGraph.User> {
|
||||
for await (const user of users) {
|
||||
if (user.accountEnabled === true) {
|
||||
if (user.accountEnabled !== false) {
|
||||
yield user;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user