• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Controlling group membership programatically

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is tangentially related to the "sso and database synchronization" topic I started earlier.

Just to repeat myself, I have a user accounts database running in another webapp. I would like the contents of that database to control the group membership in JForum. For example, if a user has purchased a commercial product, that act would automatically make them members of the OwnsProductA forum group, giving that user access to product specific forums.

One solution I'm considering is to simply update the JForum database directly. Once the groups are created, I'm assuming that their group_id would never change. I could hard-code these and simply update the jforum_user_groups table directly.

Is this safe thing to do?
[originally posted on jforum.net by jbucanek]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Optionally, it is possible to create your own implimentations of the 3 or so *Group*DAO interfaces (and I think you have to futz with the ForumDAO too) so that the your apps groups are used instead of jforums.

This is not for the faint hearted and takes a good deal of testing and debugging to get right. But I know it's do-able because I did it.

You will need to decide how to deal with jForum's admin screens, whether to have local jforum groups or not, etc.

The one possible "gotcha" is mapping your apps admin role to jForums admin rights. The ID on my app's admin was 1 and jforum's default is 2 (General/Anonymous is 1 in Jforum). I had to do some role and role_value DB table "massaging" to finally get it write.
[originally posted on jforum.net by monroe]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have any user id conflicts. I pretty much have total control over the existing customer database, and if I have to reserve Id's 1 and 2 to match the reserved accounts in JForum, that would be a trivial task.

Back to the DB question ... it still seems like it would be a lot easier to simply update the jforum_user_groups table to add group memberships. But I'm worried that there might be other table dependencies that I don't know about. (I haven't found any, but I'm pretty new to the code base.)
[originally posted on jforum.net by jbucanek]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, just add the entries to jforum_user_groups. When the user try to log in, JForum will load his groups and apply the right permissions.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!