aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java40
1 files changed, 30 insertions, 10 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java
index 45835d459..b83f751fe 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java
@@ -1,7 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2018 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.vid.roles;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import io.joshworks.restclient.http.HttpResponse;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.web.support.UserUtils;
import org.onap.vid.aai.AaiResponse;
@@ -16,8 +38,6 @@ import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
-//import org.codehaus.jackson.map.ObjectMapper;
-
/**
* Created by Oren on 7/1/17.
*/
@@ -40,21 +60,21 @@ public class RoleProvider {
public void init() {
LOG.debug(EELFLoggerDelegate.debugLogger, "Role provider => init method started");
- AaiResponse<SubscriberList> subscribersResponse = aaiService.getFullSubscriberList();
- subscribers = subscribersResponse.getT();
+ HttpResponse<SubscriberList> subscribersResponse = aaiService.getFullSubscriberList();
+ subscribers = subscribersResponse.getBody();
LOG.debug(EELFLoggerDelegate.debugLogger, "Role provider => init method finished");
}
- public List<Role> getUserRoles(HttpServletRequest request) throws JsonProcessingException {
+ public List<Role> getUserRoles(HttpServletRequest request) {
String logPrefix = "Role Provider (" + UserUtils.getUserId(request) + ") ==>";
LOG.debug(EELFLoggerDelegate.debugLogger, logPrefix + "Entering to get user role for user " + UserUtils.getUserId(request));
List<Role> roleList = new ArrayList<>();
- //Disable roles until AAF integration finishes
- /*HashMap roles = UserUtils.getRoles(request);
+
+ Map roles = UserUtils.getRoles(request);
for (Object role : roles.keySet()) {
- org.openecomp.portalsdk.core.domain.Role sdkRol = (org.openecomp.portalsdk.core.domain.Role) roles.get(role);
+ org.onap.portalsdk.core.domain.Role sdkRol = (org.onap.portalsdk.core.domain.Role) roles.get(role);
LOG.debug(EELFLoggerDelegate.debugLogger, logPrefix + "Role " + sdkRol.getName() + " is being proccessed");
try {
@@ -67,11 +87,11 @@ public class RoleProvider {
roleList.add(createRoleFromStringArr(roleParts, logPrefix));
String msg = String.format(logPrefix + " User %s got permissions %s", UserUtils.getUserId(request), Arrays.toString(roleParts));
LOG.debug(EELFLoggerDelegate.debugLogger, msg);
- } catch (RoleParsingException e) {
+ } catch (Exception e) {
LOG.error(logPrefix + " Failed to parse permission");
}
- }*/
+ }
return roleList;
}