net.nemerosa.ontrack.it.MockSecurityService.kt Maven / Gradle / Ivy
package net.nemerosa.ontrack.it
import net.nemerosa.ontrack.model.security.GlobalFunction
import net.nemerosa.ontrack.model.security.OntrackAuthenticatedUser
import net.nemerosa.ontrack.model.security.ProjectFunction
import net.nemerosa.ontrack.model.security.SecurityService
import net.nemerosa.ontrack.model.structure.Signature
import kotlin.reflect.KClass
class MockSecurityService : SecurityService {
override fun checkAuthenticated() {}
override fun checkGlobalFunction(fn: Class) {}
override fun isGlobalFunctionGranted(fn: Class): Boolean = true
override fun checkProjectFunction(projectId: Int, fn: Class) {}
override fun isProjectFunctionGranted(projectId: Int, fn: Class): Boolean = true
override val autoProjectFunctions: Set>
get() = error("Not available in mock")
override val currentAccount: OntrackAuthenticatedUser?
get() = error("Not available in mock")
override val currentSignature: Signature = Signature.Companion.of("test")
override fun runAsAdmin(supplier: () -> T): () -> T = supplier
override fun asAdmin(supplier: () -> T): T = supplier()
override fun runner(fn: (T) -> R): (T) -> R = fn
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy