summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main
diff options
context:
space:
mode:
authorAlexey Sandler <alexey.sandler@intl.att.com>2020-01-29 16:02:03 +0200
committerAlexey Sandler <alexey.sandler@intl.att.com>2020-01-29 17:04:45 +0200
commitc0cbcef18427ec1d0edfb872385f128352487464 (patch)
treef97c7e775254f58c23407cbe076d79067ce1d218 /vid-app-common/src/main
parent35a9debcc64b05163612165043690ddb128b1293 (diff)
RoleValidatorFactory respects owning-entity feature flag
Add FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY flag to response with correct type of RoleValidator Issue-ID: VID-758 Change-Id: I464fc1a155e72fedbe3f15d9745c80817db22391 Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Diffstat (limited to 'vid-app-common/src/main')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorFactory.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorFactory.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorFactory.java
index 12865401d..f4334b1be 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorFactory.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorFactory.java
@@ -25,6 +25,7 @@ package org.onap.vid.roles;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.vid.properties.Features;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.togglz.core.manager.FeatureManager;
@@ -46,8 +47,18 @@ public class RoleValidatorFactory {
}
public RoleValidator by(List<Role> roles, boolean disableRoles) {
- return disableRoles
- ? new AlwaysValidRoleValidator()
- : new RoleValidatorBySubscriberAndServiceType(roles);
+
+ if(disableRoles) {
+ return new AlwaysValidRoleValidator();
+ }
+ else if (featureManager.isActive(Features.FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY)){
+ return new RoleValidatorsComposer(
+ new RoleValidatorBySubscriberAndServiceType(roles),
+ new RoleValidatorByOwningEntity()
+ );
+ }
+ else {
+ return new RoleValidatorBySubscriberAndServiceType(roles);
+ }
}
}