Check if user is authorized to launch and Item

Use this board to ask questions or have discussions with other Atrium users.
Post Reply
esdaled
Profound User
Posts: 72
Joined: Fri May 08, 2009 2:43 pm
First Name: David
Last Name: Esdale
Company Name: Guardian General Insurance
City: Port of Spain
State / Province: Outside Canada/USA
Country: Trinidad and Tobago
Location: Trinidad
Contact:

Check if user is authorized to launch and Item

Post by esdaled »

We have added some javascript to a page to lauch an Atrium Item. However, we have a number of users who are not authorized to use that item and would like to launch a different item for them.

We have tried the following code:

Code: Select all

function LaunchInquiry() {
	var tabObj = new Object();
	tabobj = Atrium.launchItem(29);
	if (!tabobj) {
		tabobj = Atrium.launchItem(216);
	}
}
However, tabobj is always undefined and both items launch for user authorized to both.

Is there a way to check if a user has item 29 on their navigation tree? and/or is there a way to check if launchItem was successful?
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: Check if user is authorized to launch and Item

Post by David »

Atrium.launchItem() does not return a value. It actually cannot be made to return a value because it only opens the item after an Ajax call is done to first check whether the user is authorized to the item. Atrium.launchItem() returns immediatley as the Ajax call is started.

After the Ajax call...

If the user is not authorized, nothing at all happens. If the user is authorized, it will proceed to attempt to open the item. Of course, and additional security check is also done within the launched item, so the authority check is really just used to prevent a tab opening that will fail with an ugly "not authorized" message.

We could potentially add a callback parameter to this. A function could be passed to it which would be called on completion. A parameter could be passed to the function to indicate success/failure.

Would this suit your needs?

In regard to checking authorities, the only way to do that would be through an Ajax call to a program that checks the database. Although, I would think that this would be unneccessary if you were able to get feedback from Atrium.launchItem(). Is that right?
esdaled
Profound User
Posts: 72
Joined: Fri May 08, 2009 2:43 pm
First Name: David
Last Name: Esdale
Company Name: Guardian General Insurance
City: Port of Spain
State / Province: Outside Canada/USA
Country: Trinidad and Tobago
Location: Trinidad
Contact:

Re: Check if user is authorized to launch and Item

Post by esdaled »

A callback function which received success/failure would work fine.

The Atrium User Guide should be updated as it indicates that Atrium.launchItem returns "a reference to the tab object being launched".

Thanks.
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: Check if user is authorized to launch and Item

Post by David »

Yes, that would be entirely incorrect -- sorry for any confusion.

We'll see about getting it updated and also adding the callback capability.
esdaled
Profound User
Posts: 72
Joined: Fri May 08, 2009 2:43 pm
First Name: David
Last Name: Esdale
Company Name: Guardian General Insurance
City: Port of Spain
State / Province: Outside Canada/USA
Country: Trinidad and Tobago
Location: Trinidad
Contact:

Re: Check if user is authorized to launch and Item

Post by esdaled »

Any update on this?
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: Check if user is authorized to launch and Item

Post by David »

Sorry. This is now in place, pending next release (3.3.3). An optional 3rd parameter of type "function" is added.

If the parameter is passed, the function will be called on completion of Atrium.launchItem(). A single boolean parameter will be passed to the function to indicate success/failure.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest