Description leads to You do not have permissions to access this resource or perform this operation.

2993
1
08-19-2015 04:00 PM
FrankRoberts
Occasional Contributor III

We have a significant number map services in a number of AGO maps.  Many of these services come from secure  ArcServer services that we have diligently created Map image layer files for.  We have then embed these layer files with the user name and password to the services.  The one issue we have is if the user clicks on the "Description" button for one of the layers in the service they get the following error:

ArcGIS Portal Directory | HomeLogin | Signup | Generate Token

You do not have permissions to access this resource or perform this operation.

Error: 403

Is there anyway to bybass this error?  We would really like them to be able to get to the metadata for the individual layers.  We do have url's for each of those metadata files, and we have currently embeded the url in the description found with the ArcServer rest endpoint for the services.

Thoughts or ways to not have this rather unintelligent result occur to our users?

Thanks you for your help

Tags (1)
0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

Frank,

  This is not tested but I think you can take care of this by modifying the code for the PopupMnuInfo.js in the LayerList widget.  Here is the function that adds the layers url to a html anchor tag and the issue is that the url does not contain the token info so you are getting a permission denied.  But the fact that you have the metadata url in the description property for the service layer leads to a workaround.

_getATagLabel: function() {
      var url;
      var label;
      console.info(this._layerInfo);
      var itemLayerId = this._layerInfo._isItemLayer && this._layerInfo._isItemLayer();

      if (itemLayerId) {
        url = portalUrlUtils.getItemDetailsPageUrl(
                portalUrlUtils.getStandardPortalUrl(this.layerListWidget.appConfig.portalUrl),
                itemLayerId);
        label = this.nls.itemShowItemDetails;
      } else if (this._layerInfo.layerObject &&
        this._layerInfo.layerObject.url &&
        (this._layerType === "CSVLayer" || this._layerType === "KMLLayer")) {
        url = this._layerInfo.layerObject.url;
        label = this.nls.itemDownload;
      } else if (this._layerInfo.layerObject && this._layerInfo.layerObject.url) {
/* if there is a description property then use the url from there*/
        if(this._layerInfo.description && this._layerInfo.description.indexOf("This is where you need to put the portion of your url to check for"){
            url = this._layerInfo.description;
        }else{
            url = this._layerInfo.layerObject.url;
        }
        label = this.nls.itemDesc;
      } else {
        url = '';
        label = this.nls.itemDesc;
      }

      return '<a class="menu-item-description" target="_blank" href="' +
        url + '">' + label + '</a>';
    },
0 Kudos