Hi,
I am making an app which allows the user to search their own contents from ArcGIS Online, and share with others.
But if the user includes the contents that are not open to the public, a sign-in window will pop up.
Is there an elegant way to handle this error?
Thanks.
Yuki,
That is not really an error, but intended behavior. To not have the sign-in dialog appear you would have to use a Proxy that has the credentials assigned in the proxy.config.
Robert,
Thank you for the help.
Yes, it is an intended behavior, but I cannot find an event handler provided by API.
Furthermore, it is not only the sign-in dialog problem, but the rest of the code will stop running. I just want to skip loading these layers if encountering privilege problem. In this case, is the proxy able to deal with this?
Yuki,
What does your code look like? Are you using the Portal class to access the items?
Robert,
I am not using Portal to access the items, instead, I simply use a MySQL to store the metadata, e.g. itemId, dataUrl. These layers are all from ArcGIS Online.
My code constructed in this way:
The problem raised in the second step. Because the privilege problems could be in any layers, and I cannot find a way to know whether there is an error. And the error will block the remaining codes, which is fatal.
How is the first user "passing the items" to the second user?
My initial reaction is that the right way to do this is to pass a query around. So, user A picks out 3 items from their contents and you build a query that searches ArcGIS Online, something like:
id: <item_1_id> OR id: <item_2_id> OR id: <item_3_id>
Then user B, who is viewing the items, executes the query that user A built. They will only get a response for items that they have access to.
That is exactly what I did!
But the problem is that if the first user(the owner of the data source) change the sharing status to be organizational or private later, the wrong data source will trap the second user...