Adding user to specific group via cli

Hi,

I’ve asked here before about how to add users via the cli. I did find a way by using the registration plugin to assign a default group and the User service plugin to allow creating users via web interface (which I submit with lynx). This allows us to add users and have them assigned to a group automatically.

N ow the company wants to have more than one group of users - production and test. With the User Service plugin I can specify

type

Required

The admin service required.

Possible values are add, delete, update

secret

required

The secret key that allows access to the User Service.

jid

required for delete and update operations

The bare JID (address) of the user to be administered(ie includes @yourdomain.com).

username

required for add operation

The username of the new user. ie the part before the @ symbol.

password

required for add operation

The password of the new user or the user being updated.

name

optional

The display name of the new user or the user being updated.

email

optional

But I can’t specify which group the user should belong to. The Registration plugin allows me to assign a default group and as long as I only

have one group we’re good to go. Problem is since I’m not specifying the group for the user everyone is in the default group. Does anyone

know a way to create a user AND specify group via web or a script?

Maybe if the User Service plugin would specify group it would be good. Maybe there’s another way?

Thanks,

Grant

Or maybe I can use the User Import/Export plugin and submit custom XML files to add the user? There is a group field. I’m not sure how I’d spawn it from the cli though.

Just thinking out loud.

Grant

After spending more time with the User Import/Export pluging I’m not sure what it does. When you import an XML file it says “All users added successfully.” And yet it doesn’t add anything. I checked the docs and it says “When importing, no new users will be created but if the user exists in the user store thier roster will be loaded.”. So it looks like it doesn’t add users at all even if the status message says it does. I exported and it looks like it exports all users and their buddy lists. Not sure how this is useful - still looking.

Grant

Hi Grant,

The statement in the Import/Export plugin documentation of “When importing, no new users will be created but if the user exists in the user store thier roster will be loaded.” applies only to when you’re using a read-only user store such as LDAP or POP3.

As for the user service plugin are you using an old verion by chance? Verison 1.3.0 added support for assigning user to groups.

Hope that helps,

Ryan