Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extra attrs not added #12

Open
jkester1986 opened this issue Apr 2, 2018 · 4 comments
Open

extra attrs not added #12

jkester1986 opened this issue Apr 2, 2018 · 4 comments

Comments

@jkester1986
Copy link
Contributor

jkester1986 commented Apr 2, 2018

When I have my user object as something like this:

{ name: req.body.email, password: 'test1234', givenName: req.body.fName, sn: req.body.lName, mobile: req.body.mobile, title: req.body.designation, uid: req.body.uid }

only the name/pw is added to the new user's account. The otehr attributes are just ignored.

Am running Zimbra 8.8.6_GA

@grishick
Copy link
Owner

grishick commented Apr 6, 2018

@jkester1986 can you post the full request?

@jkester1986
Copy link
Contributor Author

I don't have my original code anymore, but I did try running with your readme Example 1, modified for my own settings:

zmClient.createAccount(host,{sn:"Solovyev",givenName:"Greg",displayName:"Greg Solovyev",password:"test123",name:"[email protected]"},authToken, function(err1,accountObj) { if(err1 != null) { if(err1.code == "account.ACCOUNT_EXISTS") { console.log("an account with this name already exists"); } else { console.log(err1.message); } } else { console.log("new account ID" + accountObj.id); } } );

The SOAP xml that's created ends up looking like this:

<CreateAccountRequest xmlns='urn:zimbraAdmin'> <sn>Solovyev</sn> <givenName>Greg</givenName> <displayName>Greg Solovyev</displayName> <password>test123</password> <name>[email protected]</name> </CreateAccountRequest>

But it should actually look like this:

<CreateAccountRequest xmlns='urn:zimbraAdmin'> <name>[email protected]</name> <password>test123</password> <a n='displayName'>Greg Solovyev</a> <a n='givenName'>Greg</a> <a n='sn'>Solovyev</a> </CreateAccountRequest>

I was able to figure out the actual user object structure, which should look like this:

{ name: '[email protected], password: 'test123', a: [ //extra user params must be in an array of <a> xml tags, with their own attributes and content { '@': { n: 'displayName', }, '#': 'Greg Solovyev' }, { '@': { n: 'givenName', }, '#': 'Greg' }, { '@': { n: 'sn', }, '#': 'Solovyev' }, ] }

So, it turns out it's not that the function doesn't work, it's that the user object in Example 1 needs to be updated

@jkester1986
Copy link
Contributor Author

also, apologies for everything appearing on one line in the code chunks, I had them separated out but github is ignoring all the new lines for some reason? I don't know if there's a way to fix that, but would love to clean it up

@siriusdaniellima
Copy link

@jkester1986 your object structure works perfectly, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants