aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src
diff options
context:
space:
mode:
authorOfir Sonsino <os0695@att.com>2017-09-20 13:51:01 +0300
committerOfir Sonsino <os0695@att.com>2017-09-20 13:51:11 +0300
commitcbdd17f586a4914890bd2b26ee91be135568f38c (patch)
tree20ce01ce19b479455cb2a572a4cbfa1897ecd93c /vid-app-common/src
parent9dfd7e28c1eb348fcb4a2de8c6faae2a01b34942 (diff)
Add a flag to disable Role Management
Issue-ID: VID-65 Change-Id: I1bc6f2044885c5abe4c43ad3573d41a080688701 Signed-off-by: Ofir Sonsino <os0695@att.com>
Diffstat (limited to 'vid-app-common/src')
-rw-r--r--vid-app-common/src/main/java/org/openecomp/vid/roles/RoleValidator.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/roles/RoleValidator.java b/vid-app-common/src/main/java/org/openecomp/vid/roles/RoleValidator.java
index e26c52315..a7085e596 100644
--- a/vid-app-common/src/main/java/org/openecomp/vid/roles/RoleValidator.java
+++ b/vid-app-common/src/main/java/org/openecomp/vid/roles/RoleValidator.java
@@ -10,6 +10,7 @@ import java.util.Map;
*/
public class RoleValidator {
+ private boolean disableRoles = true;
private List<Role> userRoles;
public RoleValidator(List<Role> roles) {
@@ -17,6 +18,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 +28,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 +38,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 +52,8 @@ public class RoleValidator {
}
public boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenant) {
+ if(this.disableRoles) return true;
+
for (Role role : userRoles) {
if (role.getSubscribeName().equals(globalCustomerId)
&& role.getServiceType().equals(serviceType)