Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > where is the cmscontext user object set View modes: 
User avatar
Member
Member
fan4u - 8/24/2011 5:34:40 PM
   
where is the cmscontext user object set
We are trying to store the cmscontext user variable called ( organization_guid ) in to a session & use the custom macro to retrieve the value from session .
There are scenarios where the organization_guid needs to change within the same login context. That is the reason we are storing the value in session & overriding the session
Variable.

We would like to know which part of code sets the Cmscontext user object , so that we can add code to save it to session as well when a user logs in.

Thanks in Advance,
Satish

User avatar
Member
Member
kentico_michal - 8/26/2011 10:02:28 AM
   
RE:where is the cmscontext user object set
Hello,

I would suggest using the Login1_LoggedIn handler of Logon form web part (~\CMSWebParts\Membership\Logon\LogonForm.ascx.cs). This event is fired after successful login.

However, the CMSContext.CurrentUser is not initialized so you will need to manually access the UserInfo object by using UserInfoProvider.GetFullUserInfo method and the username from Login control:

// Current username
string userName = Login1.UserName;
UserInfo user = UserInfoProvider.GetFullUserInfo(userName);


Best regards,
Michal Legen

User avatar
Member
Member
smuhajir-hotmail - 10/29/2011 4:01:00 AM
   
RE:where is the cmscontext user object set
Hi,
So, where would cmscontext be set if you were using any other mode of authentication? e.g windows
I am guessing the above is true for forms authentication mode only?
Regards

User avatar
Member
Member
kentico_michal - 11/7/2011 2:36:36 AM
   
RE:where is the cmscontext user object set
Hello,

Yes, the aforementioned approach can be applied only when forms authentication is used. You can take advantage of OnAuthentication handler that gets invoked when a user attempts to sign in with a name and password. You can implement this event to perform some custom action.

For more information about this handler, I would like to point you to the following article: Security handler.


Best regards,
Michal Legen