diff options
author | Eylon Malin <eylon.malin@intl.att.com> | 2020-02-12 18:22:59 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-02-12 18:22:59 +0000 |
commit | f3ae1b251eecdf18c2827eb03db23e10ad9ddb76 (patch) | |
tree | 231738b3b40b6ffec28fdbb433635ecbd052412b /vid-app-common/src/main | |
parent | 9b2482888c7ac3da22ef9eb41ffc5b7ac864f672 (diff) | |
parent | c2bfa8b1e903471f60fd5531c260ced8c9d1eb47 (diff) |
Merge "Feature toggle for owning-entities filtering"
Diffstat (limited to 'vid-app-common/src/main')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/properties/Features.java | 1 | ||||
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/services/CategoryParameterServiceWithRoles.kt | 12 |
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 } |