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.security.SessionInfo; 35 36 41 42 public class UserConsoleAction extends AuthenticatedAction { 43 44 47 public UserConsoleAction() { 48 super(); 49 } 50 51 54 protected ActionForward onExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, 55 HttpServletResponse response) throws Exception { 56 SessionInfo info = this.getSessionInfo(request); 57 info.setNavigationContext(SessionInfo.USER_CONSOLE_CONTEXT); 58 CoreUtil.resetMainNavigation(request.getSession()); 59 MenuTree menuTree = NavigationManager.getMenuTree(CoreMenuTree.MENU_ITEM_MENU_TREE); 60 ActionForward fwd = menuTree.getFirstAvailableActionForward(menuTree.rebuildMenus(request)); 61 if (fwd == null) { 62 throw new Exception ("Use does not have any permission for using the current navigation context."); 63 } 64 return fwd; 65 66 } 67 68 public int getNavigationContext(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { 69 return SessionInfo.MANAGEMENT_CONSOLE_CONTEXT | SessionInfo.USER_CONSOLE_CONTEXT; 70 } 71 72 } | Popular Tags |