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]
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]
... 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]
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]
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]