1 19 20 package com.sslexplorer.navigation.actions; 21 22 import javax.servlet.http.HttpServletRequest ; 23 import javax.servlet.http.HttpServletResponse ; 24 25 import org.apache.struts.action.ActionForm; 26 import org.apache.struts.action.ActionForward; 27 import org.apache.struts.action.ActionMapping; 28 29 import com.sslexplorer.core.CoreMenuTree; 30 import com.sslexplorer.core.CoreUtil; 31 import com.sslexplorer.core.actions.AuthenticatedAction; 32 import com.sslexplorer.navigation.MenuTree; 33 import com.sslexplorer.navigation.NavigationManager; 34 import com.sslexplorer.policyframework.PolicyDatabaseFactory; 35 import com.sslexplorer.security.SessionInfo; 36 37 42 43 public class ManagementConsoleAction extends AuthenticatedAction { 44 45 48 public ManagementConsoleAction() { 49 super(); 50 } 51 52 55 protected ActionForward onExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, 56 HttpServletResponse response) throws Exception { 57 SessionInfo info = this.getSessionInfo(request); 58 if(!PolicyDatabaseFactory.getInstance().isAnyAccessRightAllowed(info.getUser(), true, true, false)) { 59 throw new Exception ("You do not have permission to use the management console."); 60 } 61 info.setNavigationContext(SessionInfo.MANAGEMENT_CONSOLE_CONTEXT); 62 CoreUtil.resetMainNavigation(request.getSession()); 63 MenuTree menuTree = NavigationManager.getMenuTree(CoreMenuTree.MENU_ITEM_MENU_TREE); 64 ActionForward fwd = menuTree.getFirstAvailableActionForward(menuTree.rebuildMenus(request)); 65 if (fwd == null) { 66 throw new Exception ("User does not have any permission for using the current navigation context."); 67 } 68 return fwd; 69 70 } 71 72 public int getNavigationContext(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { 73 return SessionInfo.MANAGEMENT_CONSOLE_CONTEXT | SessionInfo.USER_CONSOLE_CONTEXT; 74 } 75 76 } | Popular Tags |