This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Determine the group

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings,

I need a way to access information about group membership on the template. I only want to show information to a specific group (that is not explizitely admin or moderator). How can I achieve this?
[originally posted on jforum.net by Sid]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Might have found a solution to it (not tested yet) by saving the User object in the session. There I have access to the list of groups that the user is linked with and just check if the given groupId matches a group in the list ...
[originally posted on jforum.net by Sid]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One question...

... I noticed that the "user" that is being set in one method of usersession has no groups linked to it at all.

So currently I query the database (getuserdao.seletbyid thing).. to retrieve the user with all his currently linked groups, whenever "user" is set to 'null' in the user session.

Not sure if there's a more suitable way to solve it... but it did the trick
[originally posted on jforum.net by Sid]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FWIW, I too have noticed this is something to be wary of. There are a lot of places where the entity objects are created a "lite" object. E.g., only a minimum of info and no real lookup of the full data.

Most of them make sense from a performance point of view, so it's not a complaint. Just something you have to be aware of if you splunk in the dark recesses of jForum's code.
[originally posted on jforum.net by monroe]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess a different approach would be having a full object in the session and using the observer pattern, so that the model gets updated whenever there was update queries to the database ...

This shouldnt have a bad impact on performance either I think
[originally posted on jforum.net by Sid]
 
This tiny ad will self destruct in five seconds.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic