web.rolemgt.edit-permissions.jsp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.wso2.carbon.role.mgt.ui
Show all versions of org.wso2.carbon.role.mgt.ui
This is the core module of the project.
The newest version!
<%--
Copyright (c) 2024 WSO2 LLC. (http://www.wso2.com) All Rights Reserved.
WSO2 LLC. licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file except
in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
--%>
<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
<%@ page import="org.owasp.encoder.Encode" %>
<%@ page import="org.wso2.carbon.CarbonConstants" %>
<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
<%@ page import="org.wso2.carbon.user.mgt.stub.types.carbon.UIPermissionNode" %>
<%@ page import="org.wso2.carbon.user.mgt.ui.UserAdminClient" %>
<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
<%@ page import="javax.servlet.jsp.JspWriter" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.text.MessageFormat" %>
<%@ page import="java.util.ResourceBundle" %>
<%@ page import="org.wso2.carbon.user.mgt.ui.UserManagementUIException" %>
<%@ page import="org.wso2.carbon.user.mgt.ui.Util" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
<%!
private void printNodesOfTree(UIPermissionNode parentNode, String parentNodeName,
int count, JspWriter out) throws IOException {
if (parentNode == null) {
return;
}
try {
UIPermissionNode[] children = parentNode.getNodeList();
String displayName = parentNode.getDisplayName();
String path = parentNode.getResourcePath();
String thisNodeName = "tempNode" + count;
out.write("var " + thisNodeName + " = new YAHOO.widget.TaskNode({label:\""
+ displayName + "\",labelData:\"" + path + "\"}, " + parentNodeName + ", true, "
+ parentNode.getSelected() + ");");
if (children != null) {
for (UIPermissionNode child : children) {
count++;
printNodesOfTree(child, thisNodeName, count, out);
}
}
} catch (IOException e) {
throw e;
}
}
%>
<%
String BUNDLE = "org.wso2.carbon.role.ui.i18n.Resources";
ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE, request.getLocale());
String prevPage = request.getParameter("prevPage");
String encryptedPrevUser = request.getParameter("prevUser");
String prevPageNumber = request.getParameter("prevPageNumber");
String decryptedPrevUser = null;
UIPermissionNode rootNode = null;
String roleName = request.getParameter("roleName");
try {
if (encryptedPrevUser != null) {
decryptedPrevUser = Util.getDecryptedUsername(encryptedPrevUser);
}
String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
ConfigurationContext configContext =
(ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
UserAdminClient client = new UserAdminClient(cookie, backendServerURL, configContext);
rootNode = client.getRolePermissions(roleName);
} catch (Exception e) {
String message = MessageFormat.format(resourceBundle.getString("error.while.loading.ui.permission"),
e.getMessage());
%>
<%
}
%>
<%=Encode.forHtmlContent(roleName)%>
© 2015 - 2024 Weber Informatics LLC | Privacy Policy