aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2020-02-12 08:40:26 +0200
committerIttay Stern <ittay.stern@att.com>2020-02-12 09:48:21 +0200
commitc2bfa8b1e903471f60fd5531c260ced8c9d1eb47 (patch)
treea57213daaf4de7167ded86f75506a098b6ea3290 /vid-app-common/src/main/java
parent947262d4f624ef0a8a9e933fbb5c2636f26f837e (diff)
Feature toggle for owning-entities filtering
Add roles for all tests' users for all tests' owning-entities; namely "aaa1", "WayneHolland" and "Melissa". Issue-ID: VID-758 Change-Id: I54cac487325b6fd1fb9ef0f7a0d18c05c5e353c0 Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/main/java')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/properties/Features.java1
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/CategoryParameterServiceWithRoles.kt12
2 files changed, 8 insertions, 5 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
index cc3fad65e..219b65def 100644
--- a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
+++ b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
@@ -86,6 +86,7 @@ public enum Features implements Feature {
FLAG_2002_UNLIMITED_MAX,
FLAG_MORE_AUDIT_INFO_LINK_ON_AUDIT_INFO,
FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY,
+ FLAG_2006_LIMIT_OWNING_ENTITY_SELECTION_BY_ROLES,
FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF,
;
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/CategoryParameterServiceWithRoles.kt b/vid-app-common/src/main/java/org/onap/vid/services/CategoryParameterServiceWithRoles.kt
index f059e590c..c9b9d1417 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/CategoryParameterServiceWithRoles.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/services/CategoryParameterServiceWithRoles.kt
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore
import org.onap.vid.category.CategoryParameterOptionRep
import org.onap.vid.category.CategoryParametersResponse
import org.onap.vid.model.CategoryParameter
+import org.onap.vid.properties.Features
import org.onap.vid.roles.RoleProvider
import org.onap.vid.roles.WithPermissionPropertiesOwningEntity
import org.springframework.beans.factory.annotation.Qualifier
@@ -22,7 +23,7 @@ class CategoryParameterServiceWithRoles(
private val owningEntityKey = "owningEntity"
- private fun shouldTreatPermissions() = false
+ private fun shouldTreatPermissions() = featureManager.isActive(Features.FLAG_2006_LIMIT_OWNING_ENTITY_SELECTION_BY_ROLES)
override fun getCategoryParameters(familyName: CategoryParameter.Family?): CategoryParametersResponse {
val categoryParameters =
@@ -50,10 +51,11 @@ class CategoryParameterServiceWithRoles(
?.filter { userRolesValidator.isServicePermitted(it) }
}
-
- class OwningEntityOptionRep(categoryParameterOptionRep: CategoryParameterOptionRep) :
- CategoryParameterOptionRep(categoryParameterOptionRep.id, categoryParameterOptionRep.name),
- WithPermissionPropertiesOwningEntity {
+ /**
+ * Encapsulates a CategoryParameterOptionRep where id field contains an owningEntityId
+ */
+ class OwningEntityOptionRep(option: CategoryParameterOptionRep) :
+ CategoryParameterOptionRep(option.id, option.name), WithPermissionPropertiesOwningEntity {
override val owningEntityId: String?
@JsonIgnore get() = id
}