diff options
author | 2017-07-07 07:21:10 -0400 | |
---|---|---|
committer | 2017-07-07 07:22:13 -0400 | |
commit | 3e7145fc12ed8475ba10bb2a3c63004d41aa42bc (patch) | |
tree | c205d84c80e4786708caa705683a56de37c5ed2d /ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java | |
parent | 952895873b6179857c6773086a4d2b55f086bd61 (diff) |
[PORTAL-25] Role Centralization
Bump EP SDK version to 1.3.0-SNAPSHOT
Support Role Centralization & Common Set of Roles across All ONAP On-Boarded Applications
Change-Id: Icfc1bbfddaf2c7c7176b4cf7bb7017d853c63100
Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java')
-rw-r--r-- | ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java | 18 |
1 files changed, 11 insertions, 7 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 a774274c..a40b20ac 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 @@ -64,9 +64,10 @@ public class ProfileController extends RestrictedBaseController { private String viewName; @RequestMapping(value = { "/profile" }, method = RequestMethod.GET) - public ModelAndView profile(HttpServletRequest request) { + public ModelAndView profile(HttpServletRequest request, HttpServletResponse response) { Map<String, Object> model = new HashMap<String, Object>(); ObjectMapper mapper = new ObjectMapper(); + User user = UserUtils.getUserSession(request); User profile = null; Long profileId = null; @@ -83,7 +84,7 @@ public class ProfileController extends RestrictedBaseController { model.put("stateList", mapper.writeValueAsString(getStates())); model.put("countries", mapper.writeValueAsString(getCountries())); model.put("timeZones", mapper.writeValueAsString(getTimeZones())); - model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles())); + model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles(user.getOrgUserId()))); model.put("profile", mapper.writeValueAsString(profile)); model.put("profileId", mapper.writeValueAsString(profileId)); } catch (Exception e) { @@ -99,6 +100,7 @@ public class ProfileController extends RestrictedBaseController { User profile = null; Long profileId = null; + User user = UserUtils.getUserSession(request); profile = UserUtils.getUserSession(request); profileId = profile.getId(); @@ -108,7 +110,7 @@ public class ProfileController extends RestrictedBaseController { model.put("stateList", mapper.writeValueAsString(getStates())); model.put("countries", mapper.writeValueAsString(getCountries())); model.put("timeZones", mapper.writeValueAsString(getTimeZones())); - model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles())); + model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles(user.getOrgUserId()))); model.put("profile", mapper.writeValueAsString(profile)); model.put("profileId", mapper.writeValueAsString(profileId)); } catch (Exception e) { @@ -121,6 +123,7 @@ public class ProfileController extends RestrictedBaseController { public void getSelfProfile(HttpServletRequest request, HttpServletResponse response) { Map<String, Object> model = new HashMap<String, Object>(); ObjectMapper mapper = new ObjectMapper(); + User user = UserUtils.getUserSession(request); User profile = null; Long profileId = null; @@ -133,7 +136,7 @@ public class ProfileController extends RestrictedBaseController { model.put("stateList", mapper.writeValueAsString(getStates())); model.put("countries", mapper.writeValueAsString(getCountries())); model.put("timeZones", mapper.writeValueAsString(getTimeZones())); - model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles())); + model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles(user.getOrgUserId()))); model.put("profile", mapper.writeValueAsString(profile)); model.put("profileId", mapper.writeValueAsString(profileId)); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -148,6 +151,7 @@ public class ProfileController extends RestrictedBaseController { @RequestMapping(value = { "/get_profile" }, method = RequestMethod.GET) public void GetUser(HttpServletRequest request, HttpServletResponse response) { Map<String, Object> model = new HashMap<String, Object>(); + User user = UserUtils.getUserSession(request); ObjectMapper mapper = new ObjectMapper(); try { User profile = null; @@ -162,7 +166,7 @@ public class ProfileController extends RestrictedBaseController { model.put("stateList", mapper.writeValueAsString(getStates())); model.put("countries", mapper.writeValueAsString(getCountries())); model.put("timeZones", mapper.writeValueAsString(getTimeZones())); - model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles())); + model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles(user.getOrgUserId()))); model.put("profile", mapper.writeValueAsString(profile)); model.put("profileId", mapper.writeValueAsString(profileId)); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -345,8 +349,8 @@ public class ProfileController extends RestrictedBaseController { } @SuppressWarnings("rawtypes") - public List getAvailableRoles() { - return roleService.getAvailableRoles(); + public List getAvailableRoles(String requestedLoginId) throws Exception { + return roleService.getAvailableRoles(requestedLoginId); } }
\ No newline at end of file |