powered by Jive Software

Change request on the userservice plugin

I would like to raise a change request on the userservice plugin to create shared groups.

At the moment, the plugin when creating a new user or updating an existing user adds the user to a supplied list of shared groups. If the group does not exist, it fails silently. I have a use case that requires the group to be auto-created in such a condition.

I have implemenetd this change and tested it ok. The patch is attached to this post.

If I do not get any objections in the next few days, I will create an issue on Jira and apply the changes to the plugin for Openfire version 3.9.0

1 Like

Sounds like a good idea to me. May just want to worry about the read-only LDAP group provider case.

Nothing to worry about

It will throw an UnsupportedOperationException exception

throw new UnsupportedOperationException(“Cannot create groups via read-only provider”);

which will be caught by the plugin and reported back to the invoker of the HTTP request

catch (Exception e) {

replyError(e.toString(),response, out);

}

Hi,

Can somebody add this change to original file?

Don’t really know how to apply patch.

I have some issues when I am adding new user with group name “friends”, after creation his groups are set to “None”. But when I am creating roster and adding with group name “friends” this groups exists there…

Don’t really know.

Could you help me?

Chers

rbrus

Can you re-check what you doing and post the request with the results you are getting.

According to the code,

The following example adds a user, adds two shared groups (if not existing) and adds the user to both groups.

http://example.com:9090/plugins/userService/userservice?type=add&secret=bigsecret&username=kafka&password=drowssap&name=franz&email=franz@kafka.com&groups=support,financebigsecret&username=kafka&password=drowssap&name=franz&email=franz@kafka.com&groups=support,finance

The following example adds new roster item with subscription ‘both’ for user ‘kafka’ and adds kafka to roster groups ‘family’ and ‘friends’

http://example.com:9090/plugins/userService/userservice?type=add_roster&secret=bigsecret&username=kafka&item_jid=franz@example.com&name=franz&subscription=3&groups=family,friendsce?type=add_roster&secret=bigsecret&username=kafka&item_jid=franz@example.com&name=franz&subscription=3&groups=family,friends

Note the difference between a **roster **group and a **shared **group

Hi Dele Olajide,

For now I am using userservice plugin from May 2013 (this one which I found on igniterealtime.org).

I saw your post and I was wondering mayby you had same problem us I have now.

I downloaded your patch file but I don’t know how to apply it. Mayby you have a .jar file with your change included?

Describing the problem:

http://example.com:9090/plugins/userService/userservice?

type=add&secret=bigsecret&username=kafka&password=drowssap&name=franz

&email=franz@kafka.com&groups=support,finance

this is exactly what I am using. And after that when I am checking my user in Users/Groups tab this user is not asign to any group.

But if, before adding a new user I will add e.g. ‘support’ group manually at Openfire Admin Panel -> Users/Groups -> Groups, and after that if I will add user (using some URL) user will be asign to this group.

Don’t know exactly where is the issue…

Thanks

My patch has been applied to Openfire in VCS. Just download source code and build the user service plugin or use the already built one attached to my reply
userservice.jar (16782 Bytes)

1 Like

Hi,

you are using this plugin with current version of openfire?

This is information that I am getting : Ignoring plugin userservice: requires server version 3.9.0

Your change based on old version of userservice?

Thanks

Change OPENFIRE_HOME/plugins/userservice/plugin.xml

3.9.0

to

3.8.2

All plugins in VCS have been edited for 3.9.0. It should work with 3.8.x

1 Like

Hi thx for tip it works now… but I am getting this error (.NET):

Exception info: The remote server returned an error: (500) Internal Server Error.

From function HttpWebRequest.GetResponse() it seems Response is never there.

It happens when I am creating (add) new user.

My test:

  • Create 6 users in 3 groups (2 user per group).

Result:

  • Groups were created (success - perfect)

  • Users were added but they are not asign to any of those groups

  • And I am receiving Exception for every user creation. (I was thinking that mayby group already exist I got this ex, but it is for every user).

  • Deleting users works fine.

My logs from Warn section:

2013.12.06 11:19:32 org.eclipse.jetty.servlet.ServletHandler - Error for /plugins/userService/userservice

java.lang.NoSuchMethodError: org.jivesoftware.openfire.group.Group.getProperties()Lorg/jivesoftware/util/Per sistableMap;

at org.jivesoftware.openfire.plugin.UserServicePlugin.createUser(UserServicePlugin .java:116)

at org.jivesoftware.openfire.plugin.userService.UserServiceServlet.doGet(UserServi ceServlet.java:141)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

at org.jivesoftware.openfire.container.PluginServlet.handleServlet(PluginServlet.j ava:269)

at org.jivesoftware.openfire.container.PluginServlet.service(PluginServlet.java:10 9)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:547)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1359)

at org.jivesoftware.admin.PluginFilter.doFilter(PluginFilter.java:78)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1330)

at org.jivesoftware.admin.AuthCheckFilter.doFilter(AuthCheckFilter.java:164)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1330)

at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:11 8)

at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1330)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:22 7)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:94 1)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186 )

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875 )

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)

at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandler Collection.java:250)

at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.jav a:149)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)

at org.eclipse.jetty.server.Server.handle(Server.java:349)

at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441)

at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConne ction.java:919)

at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:582)

at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)

at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51 )

at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.jav a:586)

at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java :44)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598 )

at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)

at java.lang.Thread.run(Unknown Source)

Thanks

Looks like I was wrong. You need OF 3.9.0

1 Like

I’ve bugged Guus about getting this release out the door soon…

1 Like

Ok thanks guys,

I will wait for new realease.

Cheers

Here is a version I compiled a while back for 3.8.2. I hope it works for you
userservice.jar (16598 Bytes)

1 Like

Hi,

I didn’t have time but eventually I tested this version and there is small issue when I am removing account it is not really removing rosters from that account. Later, when I will add account with same name it has already rosters in his roster list (same as before deleting account).

Which was really userfull for me.

This is an issue or this change will be in next userservice released?

Thanks

That sounds like a referential integrity error to me. I will take a look as soon as I am free and raise a fault. Can’t promise when it will be fixed unless someone else submits a fix to speed things up

1 Like

Opened Jira ticket on this

Ok,

one more thing, in previous version of UserService plugin it was working I was wondering why now it is not working, mayby issue is somewhere else, it should not be a new funcionality if it was working before.

What you think.

Cheers

Hold the horses

If it was working before, then we are looking at a different issue. It means delete user was removing roster items automatically and now it isn’t.

We need to do more some more investigation

1 Like