XML Access Exception Handling

27288

One of the biggest time costs for any custom code we write for HighQ sites involves checking if a user has access to an iSheet/View combination using the checkUserAccess method, this is because if you attempt to access an XML feed that you don't have access to you get thrown to:

Access restricted


You do not have access to this content. This may be because you don't have permission to this specific piece of content or because you don't have access to the site.

 

The main issue with this is there's no way back for the user to the page, if they don't have access to say 1 of 10 isheets you attempt to access via the XML feed in code then they'll always get thrown to this screen.

Rather than automatically handle the issue like this, if there's a request for:

sheetViewExportXML.action&metaData.siteID=99999&metaData.sheetId=9999&metaData.sheetViewID=999999&metaData.isheetExportType=xml

and I don't have access, return a standard error code rather than a hard redirect.

  • A note for anyone looking at this, fetch can ignore these forced redirects, however fetch doesn't have support in IE or the early versions of edge so if you still have users on those (which I imagine every law firm does) then it won't work - even the polyfilled versions of fetch can't do it.

  • Ryan McDonough I seem to have stumbled on a solution to this that's IE safe without ever coming across the issue you face! ...although, I'm not entirely sure why my code is exempt :) If you're still battling this problem, I'll happily walk you through my solution and you can see where the difference lies?

  • Ryan McDonough Mark Salamon . Good news, it looks like a hidden gem has crept into 5.5. Export xml now includes &errorWithoutRedirection=false at the end of it (manage views -> select view). On my testing just there now it looks like it is default behaviour and it doesn't actually have to be appended at all. No more redirects happening.

  • David Corrin Interestingly I worked with HIghQ to get this in, glad to see it made into 5.5 - we've just got that release at our end so I'll be implementing into our JS libraries this week.