How to do display security check authorization?

45 Views Asked by At

I am working around permission model in my project so when a particular user is not authorized then a screen is displayed depicting that the a user is not authorized to access the screen (which according to my best knowledge comes from a ArtifactExecutionFacadeImpl.groovy). Is there any possible way to show that catch that exception and show it in a message. So could you please suggest a way to do the same.

1

There are 1 best solutions below

0
On

The current code returns a 401 (unauthorized) error when the authz fails (see MoquiServlet.groovy:68). You can display a custom screen with a code change instead of just returning the 401 error, or you can modify the web.xml file to specify a page to render for that particular response code (just like you can as part of the Servlet spec for any response code through the web.xml file).

Rendering a configured screen would be a useful enhancement to the framework (would be much cleaner and more flexible than either of the approaches mentioned above). I'll think on this and may work on it in the near future. If you or anyone end up building this, feel free to send over a pull request on GitHub and I'll take a look at it.