All Downloads are FREE. Search and download functionalities are using the official Maven repository.

web.userprofile.add.jsp Maven / Gradle / Ivy

The newest version!

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar"  prefix="carbon" %>
<%@page import="org.apache.axis2.context.ConfigurationContext" %>
<%@page import="org.owasp.encoder.Encode" %>
<%@page import="org.wso2.carbon.CarbonConstants" %>
<%@page import="org.wso2.carbon.identity.user.profile.stub.types.UserFieldDTO" %>
<%@page import="org.wso2.carbon.identity.user.profile.stub.types.UserProfileDTO" %>
<%@page import="org.wso2.carbon.identity.user.profile.ui.client.UserProfileCient" %>
<%@page import="org.wso2.carbon.ui.CarbonUIMessage" %>
<%@page import="org.wso2.carbon.ui.CarbonUIUtil" %>
<%@page import="org.wso2.carbon.user.core.UserCoreConstants"%>



<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
<%@ page import="java.util.ResourceBundle" %>
<%@ page import="org.wso2.carbon.identity.user.profile.ui.client.UserProfileUIUtil" %>

<%
    String fromUserMgt =  request.getParameter("fromUserMgt");
    UserFieldDTO[] userFields = null;
    UserProfileDTO profile = null;
    String forwardTo = null;
    String[] profileConfigs = null;
	String BUNDLE = "org.wso2.carbon.identity.user.profile.ui.i18n.Resources";
	ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE, request.getLocale());
    String encryptedUsername = request.getParameter("username");
    String decryptedUsername = null;

    try {
        if (encryptedUsername != null) {
            decryptedUsername = UserProfileUIUtil.getDecryptedUsername(encryptedUsername);
        }

        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);
        UserProfileCient client = new UserProfileCient(cookie, backendServerURL, configContext);
        profile = client.getProfileFieldsForInternalStore();

        if (profile != null) {
            userFields = client.getOrderedUserFields(profile.getFieldValues());
            profileConfigs = profile.getProfileConfigurations();
        }
    } catch (Exception e) {
    	String message = resourceBundle.getString("error.while.loading.user.profile.data");
        CarbonUIMessage.sendCarbonUIMessage(message, CarbonUIMessage.ERROR, request);
        forwardTo = "../admin/error.jsp";
    }
%>

<%
    if ( forwardTo != null) {
%>



<%
    return;
    }
%>


    

    
    
    

    
<%if ("true".equals(fromUserMgt)) {%>

<%=Encode.forHtml(decryptedUsername)%>

<%} else {%>

<%}%>
<%if (profileConfigs != null && profileConfigs.length > 0 && profileConfigs[0] != null) { %> <%} %> <% if (userFields != null) { for (int i = 0; i < userFields.length; i++) { %> <%if (userFields[i].getDisplayName() != null) {%> <% if(!userFields[i].getReadOnly()) { %> <% } else { %> <% } %> <% } } } %>
*
<%=Encode.forHtmlContent(userFields[i].getDisplayName())%> <% if (userFields[i].getRequired()) {%> * <%}%>
onclick="javascript:location.href='index.jsp?username='+ '<%=Encode.forJavaScript(Encode.forUriComponent(encryptedUsername))%>&fromUserMgt=true'" <%}else{%> onclick="javascript:location.href='index.jsp?region=region5&item=userprofiles_menu&ordinal=0'" <%}%> value=""/>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy