aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main
diff options
context:
space:
mode:
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);
+ }
}
}