Select to view content in your preferred language

What's the correct way to figure out if a user has access to a certain layer

394
0
08-29-2023 05:33 AM
marius
by
New Contributor III

Hi there,

We're trying to programatically figure out if a user (john_smith) has access to a certain map layer and can load it without any issues.

For that, using the node.js SDK, after we get the web map definition, using getItemData(mapId), for each basemap layer and operational layer, we try to get the owner/access level using getItem(itemId).

Sometimes, several layers of type ArcGISFeatureLayer, have the same url, but different definitionExpression/query. Some of those layers have an itemId, some of them do not. For some layers, the query getItem(itemId) returns the following error "ArcGISRequestError: CONT_0001", but querying the layer for data, returns it without any issues (point, legend, popup info, etc).

We run the second getItem(itemId) query because although the initial getItemData(mapId) might have some layer owner and/or access property, those are usually empty.

My question is, what's the "correct" way to figure out if a user has access to a certain layer.

Thank you,

Marius

Tags (1)
0 Kudos
0 Replies