Refactor getting permissions in PigVisualizerServlet.