The default group every new user gets added to is defined by the "defaultUserGroup" configuration parameter. You can a line like the one below to your custom config file (in the WEB-INF/config directory) to use a different group:
defaultUserGroup = 5
The number is the group_id key field of the group in the jforum_groups table. I think it's also part of the URL when you edit a group's permissions as well. [originally posted on jforum.net by monroe]
I assume you are trying to link you existing application groups to jForum. In that case, yes you will have to do some custom work.
How work is needed depends on your needs.
Basically, the user membership is in the jforum_user_groups table that maps it jforum_users user_id key to the jforum_groups group_id key. If it's a one time thing or can be done via a cron job, then the right set of SQL scripts might work OK.
Or, you could add code to your main application to create a Jforum user id entry and matching group membership when a user is created.
Another possible option is to replace the jforum_users table and the jforum_user_groups table with an SQL view that mixes your application's info with the info required by JForum.
Finally, it is possible with a fair amount of customization to have jForum use group information from another source. [originally posted on jforum.net by monroe]
I can't speak to your specific application, but the way to do it using jForum would be to have a SSO authenticateUser(request) implimentation that would take information from your application (like via a cookie or URL parameters).
Validate the request in some form, e.g. an MD5 hash of the user info that your app can generate and the jForum SSO code can recreate to verify.
If it's a valid request, then check to see if the user exists in the jForum DB. If they don't, create a matching one. (See SSOUtils.register() code).
Then you can get the information about which group this user needs to be in. This could be done by passing the info via that cookie or have the code to look up this information from your apps repostitory (e.g. a database table, LDAP server, and the like). The user could then be placed in the matching jForum group based on this.
To see the some jForum specific code for adding a user to one or more group see the UserAction.groupSave() method. This is what processes the admin add a user to a group form.
You can write this to be either a "set once" method (e.g., create user / add to current group category(ies) and doesn't change). Or it can be done to check each time a user is authenticated what group they are in and modify thier entries. (Takes more time/cpu to do this...) [originally posted on jforum.net by monroe]
I have currently managed to pass the userinfo in the cookie and create and login a user if the user is not already created or login the user if the user is already created.
The example given at http://www.jforum.net/doc/ImplementSSO, takes three parameters from the existing application: userid, password and the email. But, when I tried to compile the code, I get the following error message:
"SSOCookie.java:40: cannot find symbol
symbol : method getRequest()
location: class net.jforum.JForum
HttpSession session = JForum.getRequest().getSession();
I understand that when this error is resolved, I will be able to pass the password and the email address of the user from cookie and have it create them on jForum. But, how do I associate a user to a group?
authenticateUser method returns just the userID and stores the password and email in the session from which, the jForum application creates the user.
So, now where do I call the UserAction.groupSave() method from? ( i have not myself looked at the source yet). Even if I look at it, a little is what I am going to understand.
So, if you have done something similar to my requirement please let me know.
Ranga [originally posted on jforum.net by ranga]