summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src
diff options
context:
space:
mode:
authorSonsino, Ofir (os0695) <os0695@intl.att.com>2018-11-16 15:01:29 +0200
committerSonsino, Ofir (os0695) <os0695@intl.att.com>2018-11-17 12:51:54 +0200
commit9a86fc5f609066fb90587c7ccf4a2c340565d79c (patch)
treebc692161b16e4a877abd2d550cb288731889e5ab /vid-app-common/src
parent0ce80fac351ec9450ae6905ef4ac5c550649e8f7 (diff)
Turn role management off by default
Change-Id: Ib8cf6d2a556c249f742ead7e628ae7039918c5c2 Issue-ID: VID-348 Signed-off-by: Sonsino, Ofir (os0695) <os0695@intl.att.com>
Diffstat (limited to 'vid-app-common/src')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java10
-rw-r--r--vid-app-common/src/test/resources/WEB-INF/conf/system.properties2
2 files changed, 12 insertions, 0 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java
index f4f17facb..7ac5708ee 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java
@@ -1,5 +1,6 @@
package org.onap.vid.roles;
+import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.mso.rest.RequestDetails;
import java.util.List;
@@ -10,6 +11,7 @@ import java.util.Map;
*/
public class RoleValidator {
+ private boolean disableRoles = SystemProperties.getProperty("role_management_activated") == "false";
private List<Role> userRoles;
public RoleValidator(List<Role> roles) {
@@ -17,6 +19,8 @@ public class RoleValidator {
}
public boolean isSubscriberPermitted(String subscriberName) {
+ if(this.disableRoles) return true;
+
for (Role role : userRoles) {
if (role.getSubscribeName().equals(subscriberName))
return true;
@@ -25,6 +29,8 @@ public class RoleValidator {
}
public boolean isServicePermitted(String subscriberName, String serviceType) {
+ if(this.disableRoles) return true;
+
for (Role role : userRoles) {
if (role.getSubscribeName().equals(subscriberName) && role.getServiceType().equals(serviceType))
return true;
@@ -33,6 +39,8 @@ public class RoleValidator {
}
public boolean isMsoRequestValid(RequestDetails mso_request) {
+ if(this.disableRoles) return true;
+
try {
String globalSubscriberIdRequested = (String) ((Map) ((Map) mso_request.getAdditionalProperties().get("requestDetails")).get("subscriberInfo")).get("globalSubscriberId");
String serviceType = (String) ((Map) ((Map) mso_request.getAdditionalProperties().get("requestDetails")).get("requestParameters")).get("subscriptionServiceType");
@@ -45,6 +53,8 @@ public class RoleValidator {
}
public boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName) {
+ if(this.disableRoles) return true;
+
for (Role role : userRoles) {
if (role.getSubscribeName().equals(globalCustomerId)
&& role.getServiceType().equals(serviceType)
diff --git a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
index 6a8a1a37a..f9d510a78 100644
--- a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
+++ b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
@@ -71,6 +71,8 @@ application_name = Virtual Infrastructure Deployment
element_map_file_path = app/fusionapp/files/
element_map_icon_path = app/fusionapp/icons/
+role_management_activated = false
+
#aai related properties
#dev server
#ist servers