web.roles-mgt.server-roles-mgt.jsp Maven / Gradle / Ivy
<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
<%@ page import="org.owasp.encoder.Encode" %>
<%@ page import="org.wso2.carbon.CarbonConstants" %>
<%@ page import="org.wso2.carbon.roles.mgt.ui.ServerRoleManagerClient" %>
<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
<%
String serverURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
ConfigurationContext configContext =
(ConfigurationContext) config.getServletContext().getAttribute(
CarbonConstants.CONFIGURATION_CONTEXT);
String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
ServerRoleManagerClient client;
String[] defaultServerRoles;
String[] customServerRoles;
try {
client = new ServerRoleManagerClient(configContext, serverURL, cookie);
defaultServerRoles = client.getServerRoles("Default");
customServerRoles = client.getServerRoles("Custom");
} catch (Exception e) {
CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
session.setAttribute(CarbonUIMessage.ID, uiMsg);
%>
<%
return;
}
%>
<% if ((defaultServerRoles != null) && (defaultServerRoles.length != 0) ||
(customServerRoles != null) && (customServerRoles.length != 0)) { %>