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/RoleValidatorsComposer.kt16
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) }
+
+}