UserService patch to add capability to manage user's rosters

Hi!

I had to manage users and their rosters programmatically. UserService is a good one solution to manage users, but not their rosters. I’ve added support to the plugin to add, update, delete user rosters. Attached patch adds this capability.
userService.ManageRoster.patch.zip (3847 Bytes)

1 Like

Also attached ready to use plugin.
userservice.jar (16014 Bytes)

2 Likes

Added verification of subscription parameter.
userService.ManageRoster(patch+jar).zip (18684 Bytes)

Hi

i got UserAlreadyExistsException error when tried adding roster

http://localhost:9090/plugins/userService/userservice?type=add_roster&secret=Pfy 1d2xN&username=manager&item_jid=user2@localhost&name=user2&subscription=1

‘manager’ and ‘user2’ are existing users and i want to make roster with one way presence subscription

what’s my mistake? or is it some bug in your plugin?

Hi.

I suppose there is already exist roster item “user2@localhost” in manager’s contact list.

Try to execute the script in your Openfire’s database:

select * from ofRoster

where username = ‘manager’

and jid = ‘user2@localhost’

If it return 0 rows, let me know and I verify the code of the plugin once more time.

Also, you can try to delete roster item before adding it.

i checked it of cause and there is no such roster items. ok. thank you. i’ll double check

I’ve created user with name ‘manager’ and added ‘user2@localhost’ and some other items successfuly. Works well for me.

As I know, Openfire does not verify duplicate roster items. And you can see no roster items in Admin panel, but they are in DB. You probably need clear Roster cache to make it sync with DB.

it works at other instance if Openfire server. it seems some problems with this partiсular server. will fix it.

HI,

This looks very interetsing. Is there a webpage anywhere which gives information on how to apply the patch to the jar? Also on how to use the plugin?

Best,

Mark

Hello.

Jar file attached to third message of this thread has already been patched. You should just install it like any other plugin in OpenFire admin console (if standart userservice plugin is already installed you should uninstall it first). When you install patched plugin, you can see example of plugin usage on plugin description page (http:// /plugin-admin.jsp?plugin=userservice&showReadme=true&decorator=none) or you can unzip jar and find readme.html file.

1 Like

Thanks for this.

Thank you for supplying this patch. I have created OF-674 to review and merge into trunk.

Hi.

It would be great to see it within OpenFire.

Thank you!

OK - this patch has been merged into the Openfire trunk. It will be available in the next nightly build, but if you would like to test it immediately, you can grab the plugin from the continuous integration build here (userservice.jar). We would appreciate some help testing to ensure the patch was merged correctly.

Thanks,

Tom

Hello.

I’ve downloaded the jar-file and tried to add/delete user/roster successfuly.

One thing I’ve just found is that I can add new user without specifying a password. Plugin’s readme says ‘password Required for ‘add’ operation’, but it actually does not verify if it is specified or not.

It was implemented in a such way in original plugin. Not sure if it should be changed.