This content has been marked as final.
Show 4 replies
-
1. Re: How to access the current logged in user in the entity class?
idyoshin Dec 31, 2009 4:13 PM (in response to sumathra)You can always define the component like this:
@Name("identityAuthenticator") @Scope(ScopeType.APPLICATION) @AutoCreate public class IdentityAuthenticator { @Logger Log logger; @Observer(JpaIdentityStore.EVENT_USER_AUTHENTICATED) public void onAuthenticated(UserAccount u) { logger.info("setting logged_in_contragent to {1}", u.getContragent() .getDescription()); Contexts.getSessionContext().set(UserAccount.LOGGED_IN_USER, u); } }
and refer to the currently logged in user as Contexts.getSerssionContext().get(UserAccount.LOGGED_IN_USER)
Regards,
Ilya Dyoshin
-
2. Re: How to access the current logged in user in the entity class?
cash1981 Jan 1, 2010 7:54 PM (in response to sumathra)Why use an application scoped component? That means the component is kept alive in memory until the application shutsdown. So for each user that logs into the system you keep the component. Bad idea. Use session instead.
-
3. Re: How to access the current logged in user in the entity class?
sumathra Jan 2, 2010 1:15 PM (in response to sumathra)Thanks Ilya
-
4. Re: How to access the current logged in user in the entity class?
sumathra Jan 2, 2010 1:15 PM (in response to sumathra)Thanks Shervin