summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-common/src/main/java
diff options
context:
space:
mode:
authorChristopher Lott (cl778h) <clott@research.att.com>2017-08-23 15:46:44 -0400
committerChristopher Lott (cl778h) <clott@research.att.com>2017-08-23 15:47:54 -0400
commit1683d7929869d7d5f9bda1ffad0ace619c507ce0 (patch)
tree181df2305e7b1d5960b6e0fc2c65a36eaa554068 /ecomp-sdk/epsdk-app-common/src/main/java
parentf03552714077df2a3f11fe33a81342558dfe1705 (diff)
Repair role-centralization features in EPSDK
Issue: PORTAL-21 Change-Id: Icf276482609734d3aa24f04ae0a8135021a3d305 Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src/main/java')
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java
index f4132a9e..2f17ac68 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java
@@ -28,6 +28,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import org.json.JSONObject;
import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
@@ -37,6 +38,7 @@ import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.openecomp.portalsdk.core.service.RoleService;
import org.openecomp.portalsdk.core.service.UserProfileService;
import org.openecomp.portalsdk.core.service.UserService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
import org.openecomp.portalsdk.core.web.support.AppUtils;
import org.openecomp.portalsdk.core.web.support.JsonMessage;
import org.openecomp.portalsdk.core.web.support.UserUtils;
@@ -254,6 +256,11 @@ public class ProfileController extends RestrictedBaseController {
domainUser.removeRole(role.getId());
service.saveUser(domainUser);
+ /*If adding new roles on the current logged in user, we need to update the user value in session*/
+ if(UserUtils.getUserId(request)==Integer.valueOf(profileId)){
+ HttpSession session = request.getSession(true);
+ session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), domainUser);
+ }
logger.info(EELFLoggerDelegate.auditLogger, "Remove role " + role.getId() + " from user " + profileId);
response.setCharacterEncoding("UTF-8");
@@ -294,6 +301,11 @@ public class ProfileController extends RestrictedBaseController {
User domainUser = (User) userService.getUser(profileId);
domainUser.addRole(role);
service.saveUser(domainUser);
+ /*If removing roles on the current logged in user, we need to update the user value in session*/
+ if(UserUtils.getUserId(request)==Integer.valueOf(profileId)){
+ HttpSession session = request.getSession(true);
+ session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), domainUser);
+ }
logger.info(EELFLoggerDelegate.auditLogger, "Add new role " + role.getName() + " to user " + profileId);
response.setCharacterEncoding("UTF-8");