diff options
author | Ittay Stern <ittay.stern@att.com> | 2020-01-27 19:09:19 +0200 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2020-01-28 12:13:46 +0200 |
commit | abb69004c16707e1dafa7a75050e8c026de9fe31 (patch) | |
tree | cced9ccdb8582665042b955db17c964562c9a5bb /vid-app-common/src/main/java/org/onap | |
parent | 657353741044c8cda2bbca64e2fc235837428f25 (diff) |
RoleValidatorsComposer composite several RoleValidators together
Issue-ID: VID-758
Change-Id: I7bd5a4ebc8a0a451716af09cc76e6db6cd5362f7
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/onap')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt new file mode 100644 index 000000000..873622389 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt @@ -0,0 +1,16 @@ +package org.onap.vid.roles + +class RoleValidatorsComposer(private vararg val roleValidators: RoleValidator) : RoleValidator { + + constructor(roleValidators: Collection<RoleValidator>) : this(*roleValidators.toTypedArray()) + + override fun isServicePermitted(p: WithPermissionProperties): Boolean = + roleValidators.any { it.isServicePermitted(p) } + + override fun isSubscriberPermitted(subscriberName: String?): Boolean = + roleValidators.any { it.isSubscriberPermitted(subscriberName) } + + override fun isTenantPermitted(globalCustomerId: String?, serviceType: String?, tenantName: String?): Boolean = + roleValidators.any { it.isTenantPermitted(globalCustomerId, serviceType, tenantName) } + +} |