• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

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]
 
What's that smell? Hey, sniff this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic