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