Current session of LoggedIn user

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
baskosi
Posts: 50
Joined: Fri Sep 29, 2006 9:15 pm
Location: Slovenia
Contact:

Current session of LoggedIn user

Post by baskosi »

Hi,

Is there a way to implement a 'global variable' for the current session of a user? Something like 'SystemSession' for the user (like SystemSettings are for the system).

I would like a user to pick a company (or account) from the list of companies she has access to. I use following query:

FIND Company WHERE Company IN LoggedInSystemUser.Companies ORDER BY Company.Name

...and initialization process in Visual perspective:

PICK FROM AvailableCompanies NO CONFIRMATION FOR ONE


After the company is selected any object that user creates should have its Company attribute initialized to the selected company. Something like:

IF CompanyObject IS NEW THEN
CompanyObject.Company = Company


Is there a way to do this?
Borut
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Can you add a reference to a Company for each user object in the SystemUser group? You will then initialize this attribute in the initialization process:

SystemUser.Company = Company

and then use this attribute when creating objects:

CreatedObject.Company = LoggedInSystemUser.Company
Aware IM Support Team
baskosi
Posts: 50
Joined: Fri Sep 29, 2006 9:15 pm
Location: Slovenia
Contact:

Post by baskosi »

This is my plan B :?

This approach would mean that the user can only work with one company at the time even if she opens more browser windows and logs on again in them.

Is there a way to get the session ID? This way I could save selected company and related session in LoginNotificationAttempt:

CREATE CurrentSession WITH CurrentSession.SystemUser=LoggedInCompany, CurrentSession.SessionID=CURRENT_SESSION, CurrentSession.Company=Company

Here CURRENT_SESSION is a function that doesn't exist in AwareIM :(
Borut
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Your users should generally be discouraged from working with multiple browsers on the same machine - some functionality may not work correctly. Why do you need several browsers on one machine?

Regarding CURRENT_SESSION function. If you are going to create CurrentSession object with a reference to a company, then why do you need session id? If you want to uniquely identify the instance of the CurrentSession you can do it using the instance of the SystemUser that will be stored in the CurrentSession - for example, use ID of that user.

You can create the instance of the session object in the LoginNotification and delete it in the LogoutNotification.
Aware IM Support Team
baskosi
Posts: 50
Joined: Fri Sep 29, 2006 9:15 pm
Location: Slovenia
Contact:

Post by baskosi »

Users are sometimes interrupted when amid a long form entry by a phone call that requires them to look into another companies data. This is where they would open another browser window.

If user is logged in in two browser windows she gets two different sessions. I would use session to identify which company she uses in each window.

However after your warning about opening several browsers for the same user, I'm not sure if this is a good approach when using AwareIM. I would appreciate if you can write more about 'some functionality may not work' as I'm sure sooner or later somebody will open more than one window. It is better to be prepared in advance.

I guess the safest way is to go with plan B.

Thank for the great support.
Borut
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

Another idea is to add operations for creation of objects that require a company link to the company form. Each operation will need a process with a single rule like this:

ENTER NEW MyObject WITH MyObject.Company = Company

You can then add this process as an operation to the company form. Form operations act as a context-sensitive menu where the form object is automatically available in the context. The user just needs to get to the object form and then can start any of the form operations.

Have a look at the operations available for Member form in the Library sample application.
Aware IM Support Team
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

The problem of web applications being accessed from multiple browsers on the same machine is not Aware IM - specific. Web servers may get confused as to which session the request is coming from. This means that occasionally you may see a reply intended for one session received by a different session (again this is only if you have several browsers on THE SAME machine - browsers opened on different machines never have this problem).
Aware IM Support Team
Post Reply