summaryrefslogtreecommitdiffstats
path: root/vid-app-common
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common')
-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
}