1 19 20 package com.sslexplorer.core; 21 22 import javax.servlet.http.HttpServletRequest ; 23 24 import com.sslexplorer.navigation.MenuTree; 25 import com.sslexplorer.policyframework.Permission; 26 import com.sslexplorer.policyframework.PolicyConstants; 27 import com.sslexplorer.security.SessionInfo; 28 29 34 public class PageTaskMenuTree extends MenuTree { 35 36 39 public static final String PAGE_TASK_MENU_TREE = "pageTask"; 40 41 45 public PageTaskMenuTree() { 46 super(PageTaskMenuTree.PAGE_TASK_MENU_TREE); 47 48 addMenuItem(null, new MenuItem("showUserProfiles", null, null, 100, false, SessionInfo.ALL_CONTEXTS)); 50 addMenuItem("showUserProfiles", new MenuItem("createUserProfile", "properties", 51 "/showUserProfiles.do?actionTarget=create&profileScope=personal", 100, true, null, 52 SessionInfo.USER_CONSOLE_CONTEXT, PolicyConstants.PERSONAL_PROFILE_RESOURCE_TYPE, new Permission[] { 53 PolicyConstants.PERM_MAINTAIN 54 }, null)); 55 56 addMenuItem(null, new MenuItem("showGlobalProfiles", null, null, 100, false, SessionInfo.ALL_CONTEXTS)); 58 addMenuItem("showGlobalProfiles", new MenuItem("createGlobalProfile", "properties", 59 "?actionTarget=create&profileScope=global", 100, true, PolicyConstants.PROFILE_RESOURCE_TYPE, 60 new Permission[] { 61 PolicyConstants.PERM_CREATE_EDIT_AND_ASSIGN 62 }) { 63 64 public boolean isAvailable(int checkNavigationContext, SessionInfo info, HttpServletRequest request) { 65 return super.isAvailable(checkNavigationContext, info, request); 66 } 67 }); 68 69 addMenuItem(null, new MenuItem("showAvailableRoles", null, null, 100, false, SessionInfo.ALL_CONTEXTS)); 71 addMenuItem("showAvailableRoles", new MenuItem("createRole", "security", 72 "?actionTarget=create", 100, true, 73 PolicyConstants.ACCOUNTS_AND_GROUPS_RESOURCE_TYPE, new Permission[] { 74 PolicyConstants.PERM_CREATE_EDIT_AND_ASSIGN 75 }) { 76 public boolean isAvailable(int checkNavigationContext, SessionInfo info, HttpServletRequest request) { 77 boolean available = super.isAvailable(checkNavigationContext, info, request); 78 if (available) { 79 try { 80 available = UserDatabaseManager.getInstance().getUserDatabase(info.getUser().getRealm()).supportsAccountCreation(); 81 } catch (Exception e1) { 82 available = false; 83 } 84 } 85 return available; 86 } 87 }); 88 89 addMenuItem(null, new MenuItem("showAvailableIpRestrictions", null, null, 100, false, SessionInfo.ALL_CONTEXTS)); 91 addMenuItem("showAvailableIpRestrictions", new MenuItem("createIpRestriction", "security", 92 "?actionTarget=create", 100, true, 93 PolicyConstants.IP_RESTRICTIONS_RESOURCE_TYPE, new Permission[] { 94 PolicyConstants.PERM_CREATE 95 })); 96 97 addMenuItem(null, new MenuItem("showAvailableAccounts", null, null, 100, false, SessionInfo.ALL_CONTEXTS)); 99 addMenuItem("showAvailableAccounts", new MenuItem("createAccount", "security", 100 "?actionTarget=create", 100, true, 101 PolicyConstants.ACCOUNTS_AND_GROUPS_RESOURCE_TYPE, new Permission[] { 102 PolicyConstants.PERM_CREATE_EDIT_AND_ASSIGN 103 }) { 104 public boolean isAvailable(int checkNavigationContext, SessionInfo info, HttpServletRequest request) { 105 boolean available = super.isAvailable(checkNavigationContext, info, request); 106 if (available) { 107 try { 108 available = UserDatabaseManager.getInstance().getUserDatabase(info.getUser().getRealm()).supportsAccountCreation(); 109 } catch (Exception e1) { 110 available = false; 111 } 112 } 113 return available; 114 } 115 }); 116 117 addMenuItem(null, new MenuItem("editAccount", null, null, 100, false, SessionInfo.ALL_CONTEXTS)); 119 addMenuItem("editAccount", new MenuItem("resetUserAttributes", "security", 120 "javascript: setActionTarget('resetUserAttributes'); document.forms[0].submit();", 200, true, "_self", 121 SessionInfo.MANAGEMENT_CONSOLE_CONTEXT, PolicyConstants.ACCOUNTS_AND_GROUPS_RESOURCE_TYPE, 122 new Permission[] { PolicyConstants.PERM_CREATE_EDIT_AND_ASSIGN })); 123 124 addMenuItem(null, new MenuItem("showAuthenticationSchemes", null, null, 100, false, SessionInfo.ALL_CONTEXTS)); 126 addMenuItem("showAuthenticationSchemes", new MenuItem("createAuthenticationScheme", "security", 127 "/athenticationSchemeDetails.do", 100, true, "_self", 128 SessionInfo.MANAGEMENT_CONSOLE_CONTEXT, PolicyConstants.AUTHENTICATION_SCHEMES_RESOURCE_TYPE, new Permission[] { 129 PolicyConstants.PERM_CREATE_EDIT_AND_ASSIGN 130 })); 131 132 addMenuItem(null, new MenuItem("showAttributeDefinitions", null, null, 100, false, SessionInfo.ALL_CONTEXTS)); 134 addMenuItem("showAttributeDefinitions", new MenuItem("createAttributeDefinition", "properties", 135 "?actionTarget=create&propertyClassName=userAttributes", 100, true, 136 PolicyConstants.ATTRIBUTE_DEFINITIONS_RESOURCE_TYPE, new Permission[] { 137 PolicyConstants.PERM_MAINTAIN 138 })); 139 140 141 addMenuItem(null, new MenuItem("userAttributes", null, null, 100, false, SessionInfo.ALL_CONTEXTS)); 143 addMenuItem("userAttributes", new MenuItem("resetAttributes", "security", 144 "?actionTarget=resetUserAttributes", 100, true, "_self", 145 SessionInfo.USER_CONSOLE_CONTEXT, PolicyConstants.ATTRIBUTES_RESOURCE_TYPE, new Permission[] { 146 PolicyConstants.PERM_MAINTAIN 147 })); 148 149 addMenuItem(null, new MenuItem("policies", null, null, 100, false, SessionInfo.ALL_CONTEXTS)); 151 addMenuItem("policies", new MenuItem("createPolicy", "policyframework", "/policyDetails.do", 100, true, null, 152 SessionInfo.MANAGEMENT_CONSOLE_CONTEXT, PolicyConstants.POLICY_RESOURCE_TYPE, new Permission[] { 153 PolicyConstants.PERM_CREATE_EDIT_AND_ASSIGN 154 }, null)); 155 156 addMenuItem(null, new MenuItem("configurePolicies", null, null, 100, false, SessionInfo.ALL_CONTEXTS)); 158 addMenuItem("configurePolicies", new MenuItem("createPolicy", "policyframework", "/policyDetails.do", 100, true, 159 null, SessionInfo.MANAGEMENT_CONSOLE_CONTEXT, PolicyConstants.POLICY_RESOURCE_TYPE, new Permission[] { 160 PolicyConstants.PERM_CREATE 161 }, null)); 162 addMenuItem("configurePolicies", new MenuItem("cancelConfigurePolicies", "policyframework", 163 "javascript: setActionTarget('cancel'); document.forms[0].submit()", 100, true, "_self", 164 SessionInfo.MANAGEMENT_CONSOLE_CONTEXT)); 165 166 addMenuItem(null, new MenuItem("accessRightsList", null, null, 100, false, SessionInfo.ALL_CONTEXTS)); 168 169 addMenuItem("accessRightsList", new MenuItem("createDelegationAccessRights", "policyframework", 170 "/accessRightsDetails.do?class=delegation", 100, true, null, SessionInfo.MANAGEMENT_CONSOLE_CONTEXT, 171 PolicyConstants.ACCESS_RIGHTS_RESOURCE_TYPE, 172 new Permission[] { PolicyConstants.PERM_CREATE_EDIT_AND_ASSIGN })); 173 174 addMenuItem("accessRightsList", new MenuItem("createSystemAccessRights", "policyframework", 175 "/accessRightsDetails.do?class=system", 200, true, null, SessionInfo.MANAGEMENT_CONSOLE_CONTEXT, 176 PolicyConstants.ACCESS_RIGHTS_RESOURCE_TYPE, 177 new Permission[] { PolicyConstants.PERM_CREATE_EDIT_AND_ASSIGN })); 178 179 addMenuItem("accessRightsList", new MenuItem("createPersonalAccessRights", "policyframework", 180 "/accessRightsDetails.do?class=personal", 300, true, null, SessionInfo.MANAGEMENT_CONSOLE_CONTEXT, 181 PolicyConstants.ACCESS_RIGHTS_RESOURCE_TYPE, 182 new Permission[] { PolicyConstants.PERM_CREATE_EDIT_AND_ASSIGN })); 183 184 addMenuItem(null, new MenuItem("messageQueue", null, null, 100, false, SessionInfo.MANAGEMENT_CONSOLE_CONTEXT)); 186 addMenuItem("messageQueue", new MenuItem("sendMessage", "setup", 187 "?actionTarget=sendMessage", 100, true, null, 188 SessionInfo.MANAGEMENT_CONSOLE_CONTEXT, PolicyConstants.MESSAGE_QUEUE_RESOURCE_TYPE, new Permission[] { 189 PolicyConstants.PERM_SEND 190 }, null)); 191 addMenuItem("messageQueue", new MenuItem("clearQueue", "setup", 192 "?actionTarget=confirmClearQueue", 200, true, null, 193 SessionInfo.MANAGEMENT_CONSOLE_CONTEXT, PolicyConstants.MESSAGE_QUEUE_RESOURCE_TYPE, new Permission[] { 194 PolicyConstants.PERM_CLEAR 195 }, null)); 196 197 198 addMenuItem(null, new MenuItem("showReplacements", null, null, 100, false, SessionInfo.MANAGEMENT_CONSOLE_CONTEXT)); 200 addMenuItem("showReplacements", new MenuItem("createReplacement", "services", "/showReplacements.do?actionTarget=create", 100, true, 201 "_self", SessionInfo.MANAGEMENT_CONSOLE_CONTEXT, PolicyConstants.REPLACEMENTS_RESOURCE_TYPE, 202 new Permission[] { PolicyConstants.PERM_CHANGE})); 203 204 addMenuItem(null, new MenuItem("showExtensionStore", null, null, 100, false, SessionInfo.MANAGEMENT_CONSOLE_CONTEXT)); 206 addMenuItem("showExtensionStore", new MenuItem("uploadExtension", "extensions", "/installed.do?subForm=installedExtensionsForm&actionTarget=upload", 100, true, 207 "_self", SessionInfo.MANAGEMENT_CONSOLE_CONTEXT)); 208 addMenuItem("showExtensionStore", new MenuItem("refreshExtensionStore", "extensions", "?subForm=updateableExtensionsForm&actionTarget=refresh", 100, true, 209 "_self", SessionInfo.MANAGEMENT_CONSOLE_CONTEXT)); 210 211 addMenuItem(null, new MenuItem("showKeyStore", null, null, 100, false, SessionInfo.MANAGEMENT_CONSOLE_CONTEXT)); 213 addMenuItem("showKeyStore", new MenuItem("keyStoreImport", "keystore", "/keyStoreImportType.do", 100, true, 214 "_self", SessionInfo.MANAGEMENT_CONSOLE_CONTEXT)); 215 addMenuItem("showKeyStore", new MenuItem("generateServerCertificateCSR", "keystore", "/generateServerCertificateCSR.do", 200, true, 216 "_blank", SessionInfo.MANAGEMENT_CONSOLE_CONTEXT)); 217 addMenuItem("showKeyStore", new MenuItem("downloadServerCertificateCSR", "keystore", "/downloadServerCertificateCSR.do", 300, true, 218 "_self", SessionInfo.MANAGEMENT_CONSOLE_CONTEXT)); 219 220 addMenuItem(null, new MenuItem("showShutdown", null, null, 100, false, SessionInfo.MANAGEMENT_CONSOLE_CONTEXT)); 222 addMenuItem("showShutdown", new MenuItem("broadcastShutdownMessage", "setup", "javascript: setActionTarget('sendMessage'); document.forms[0].submit();", 100, true, 223 "_self", SessionInfo.MANAGEMENT_CONSOLE_CONTEXT)); 224 225 } 226 } 227 | Popular Tags |