summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt
blob: 8736223899e78e67e64a8943d7a9bb08c3377968 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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) }

}