Index: common/src/main/java/org/glassfish/admingui/common/handlers/SecurityHandler.java =================================================================== --- common/src/main/java/org/glassfish/admingui/common/handlers/SecurityHandler.java (revision 44894) +++ common/src/main/java/org/glassfish/admingui/common/handlers/SecurityHandler.java (working copy) @@ -344,7 +344,7 @@ @HandlerInput(name="UserId", type=String.class, required=true), @HandlerInput(name="GroupList", type=String.class, required=true), @HandlerInput(name="Password", type=String.class, required=true), - @HandlerInput(name="CreateNew", type=Boolean.class)}) + @HandlerInput(name="CreateNew", type=String.class, required=true)}) public static void saveUser(HandlerContext handlerCtx) { try { String realmName = (String) handlerCtx.getInputValue("Realm"); @@ -352,7 +352,7 @@ String grouplist = (String)handlerCtx.getInputValue("GroupList"); String password = (String)handlerCtx.getInputValue("Password"); String userid = (String)handlerCtx.getInputValue("UserId"); - Boolean createNew = (Boolean)handlerCtx.getInputValue("CreateNew"); + String createNew = (String)handlerCtx.getInputValue("CreateNew"); if (password == null) { password = ""; @@ -365,19 +365,13 @@ attrs.put("realmName", realmName); RestUtil.restRequest(tmpEP, attrs, "POST", handlerCtx, false); attrs = new HashMap(); - if ((createNew == null)) { - String endpoint = GuiUtil.getSessionValue("REST_URL") + "/configs/config/" + configName + - "/security-service/auth-realm/" + realmName + "/delete-user?target=" + configName; - attrs.put("username", userid); - RestResponse response = RestUtil.delete(endpoint, attrs); - if (!response.isSuccess()) { - GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("msg.error.checkLog")); - } - createNew = Boolean.TRUE; + String endpoint = GuiUtil.getSessionValue("REST_URL") + "/configs/config/" + configName + "/security-service/auth-realm/" + realmName ; + if (Boolean.valueOf(createNew)) { + endpoint = endpoint + "/create-user?target=" + configName; + }else{ + endpoint = endpoint + "/update-user?target=" + configName; } - if ((createNew != null) && (createNew == Boolean.TRUE)) { - String endpoint = GuiUtil.getSessionValue("REST_URL") + "/configs/config/" + configName + - "/security-service/auth-realm/" + realmName + "/create-user?target=" + configName; + final String USERPASSWORD = "AS_ADMIN_USERPASSWORD"; attrs = new HashMap(); @@ -390,11 +384,7 @@ if (grouplist != null && !grouplist.equals("")) grpList.add(grouplist); attrs.put("groups", grpList); - RestResponse response = RestUtil.post(endpoint, attrs); - if (!response.isSuccess()) { - GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("msg.error.checkLog")); - } - } + RestUtil.restRequest(endpoint, attrs, "POST", null, true, true ); } catch(Exception ex) { GuiUtil.handleException(handlerCtx, ex); } @@ -520,8 +510,16 @@ "/security-service/auth-realm/" + realmName + "/list-group-names?username=" + userName + "&target=" + configName; Map responseMap = RestUtil.restRequest(endpoint, null, "get", handlerCtx, false); HashMap children = (HashMap)((Map) responseMap.get("data")).get("extraProperties"); - String name = (String)((List)children.get("groups")).get(0); - return name; + List groupList= (List)children.get("groups"); + StringBuilder groups = new StringBuilder(); + String sepHolder = ""; + if (groupList != null){ + for(String oneGroup : groupList){ + groups.append(sepHolder).append(oneGroup); + sepHolder=":"; + } + } + return groups.toString(); }catch(Exception ex){ GuiUtil.getLogger().info(GuiUtil.getCommonMessage("log.error.getGroupNames") + ex.getLocalizedMessage()); if (GuiUtil.getLogger().isLoggable(Level.FINE)){ Index: common/src/main/java/org/glassfish/admingui/common/util/RestUtil.java =================================================================== --- common/src/main/java/org/glassfish/admingui/common/util/RestUtil.java (revision 44894) +++ common/src/main/java/org/glassfish/admingui/common/util/RestUtil.java (working copy) @@ -273,6 +273,9 @@ Map dataMap = (Map)responseMap.get("data"); if (dataMap != null) { message = getMessage(dataMap); + if (message == null){ + message = ""; + } List subReports = (List)dataMap.get("subReports"); if (subReports != null){ for( Map oneSubReport : subReports){ Index: common/src/main/resources/security/realms/manageUserNew.jsf =================================================================== --- common/src/main/resources/security/realms/manageUserNew.jsf (revision 44894) +++ common/src/main/resources/security/realms/manageUserNew.jsf (working copy) @@ -81,7 +81,7 @@ UserId="#{pageSession.userId}" GroupList="#{pageSession.groupList}" Password="#{password}" - CreateNew="#{true}" + CreateNew="true" ); gf.redirect(page="#{request.contextPath}/common/security/realms/manageUsers.jsf?name=#{pageSession.encodedName}&configName=#{pageSession.encodedConfigName}") /> Index: common/src/main/resources/security/realms/manageUserEdit.jsf =================================================================== --- common/src/main/resources/security/realms/manageUserEdit.jsf (revision 44894) +++ common/src/main/resources/security/realms/manageUserEdit.jsf (working copy) @@ -83,6 +83,7 @@ UserId="#{pageSession.User}" GroupList="#{pageSession.groupList}" Password="#{pageSession.password}" + CreateNew="false" ); />