You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
688 B
Kotlin
21 lines
688 B
Kotlin
package me.eater.hefbrug.platform_utils.user
|
|
|
|
import me.eater.hefbrug.executor.ExecutionContext
|
|
import me.eater.hefbrug.platform_utils.PlatformUtil
|
|
|
|
abstract class UserManager(val context: ExecutionContext) {
|
|
protected val ro = context.roAccess
|
|
protected val rw = context.rwAccess
|
|
|
|
|
|
companion object {
|
|
private val managers: Set<PlatformUtil<UserManager>> = setOf(
|
|
UsermodManager.Util
|
|
)
|
|
|
|
suspend fun getManager(context: ExecutionContext): UserManager {
|
|
return managers.find { it.isSupported(context.roAccess) }?.getManager(context)
|
|
?: error("Can't find appropriate User Manager for your system")
|
|
}
|
|
}
|
|
} |