ghengeveld/atlassian-crowd-client

crowd.user.get(username, true) does not work after last update

Closed this issue · 3 comments

Basing on the error mesage,

I checked the file : models/attributes.js ---> attributesArr.forEach
attributesArr is NOT an array so that do NOT have forEach function.

I print out attributesArr, it is an object, NOT an array.

@kamanwu-oicr You might try pinning your dependency to the previous version.

Looks like the issue is that the Crowd api user response has an attributes object with a single attributes key (seems redundant), so this should be data.attributes.attributes.

(Confusingly, the /user/attributes endpoint does not do this weird nesting, it's just a object with an attributes key and an array).

Thanks for the catch. I should've thought this through a little more. It's obviously a breaking change.

I'm going to make a fix release to roll-back to the old user.attributes behavior, then release a v2 with the breaking change (including Alex' improvement).

There's now a v1.5.1 which rolls back the attribute mapping on User. That should fix your issue @kamanwu-oicr.