Compare commits
2
Commits
87812d02d3
...
1aa87f33c4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1aa87f33c4 | ||
|
|
5d4e855b8e |
No files matched your search
@@ -6,7 +6,28 @@ on:
|
|||||||
- "main"
|
- "main"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
test-backend:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up JDK
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: "21"
|
||||||
|
cache: gradle
|
||||||
|
cache-dependency-path: |
|
||||||
|
private/minis-backend/*.gradle.kts
|
||||||
|
private/minis-backend/gradle/wrapper/gradle-wrapper.properties
|
||||||
|
|
||||||
|
- name: Run backend tests
|
||||||
|
working-directory: private/minis-backend
|
||||||
|
run: ./gradlew test --no-daemon
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
needs: test-backend
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM gradle:7.5.1 as build_backend
|
FROM gradle:8.11-jdk-21-and-23 as build_backend
|
||||||
|
|
||||||
COPY --chown=gradle:gradle /private/minis-backend /home/gradle/src
|
COPY --chown=gradle:gradle /private/minis-backend /home/gradle/src
|
||||||
WORKDIR /home/gradle/src
|
WORKDIR /home/gradle/src
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ val logback_version: String by project
|
|||||||
val exposed_version: String by project
|
val exposed_version: String by project
|
||||||
val h2_version: String by project
|
val h2_version: String by project
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.9.0"
|
kotlin("jvm") version "2.3.21"
|
||||||
id("io.ktor.plugin") version "2.3.3"
|
id("io.ktor.plugin") version "3.5.1"
|
||||||
kotlin("plugin.serialization") version "1.9.0"
|
kotlin("plugin.serialization") version "2.3.21"
|
||||||
id("com.palantir.docker") version "0.36.0"
|
id("com.palantir.docker") version "0.36.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,10 +30,10 @@ dependencies {
|
|||||||
implementation("io.ktor:ktor-server-auth-jvm")
|
implementation("io.ktor:ktor-server-auth-jvm")
|
||||||
implementation("io.ktor:ktor-server-auth-jwt-jvm")
|
implementation("io.ktor:ktor-server-auth-jwt-jvm")
|
||||||
implementation("io.ktor:ktor-server-sessions-jvm")
|
implementation("io.ktor:ktor-server-sessions-jvm")
|
||||||
implementation("io.ktor:ktor-server-host-common-jvm")
|
|
||||||
implementation("io.ktor:ktor-server-cors-jvm")
|
implementation("io.ktor:ktor-server-cors-jvm")
|
||||||
implementation("io.ktor:ktor-server-content-negotiation-jvm")
|
implementation("io.ktor:ktor-server-content-negotiation-jvm")
|
||||||
implementation("io.ktor:ktor-serialization-kotlinx-json-jvm")
|
implementation("io.ktor:ktor-serialization-kotlinx-json-jvm")
|
||||||
|
implementation("io.ktor:ktor-server-swagger:$ktor_version")
|
||||||
implementation("org.jetbrains.exposed:exposed-core:$exposed_version")
|
implementation("org.jetbrains.exposed:exposed-core:$exposed_version")
|
||||||
implementation("org.jetbrains.exposed:exposed-jdbc:$exposed_version")
|
implementation("org.jetbrains.exposed:exposed-jdbc:$exposed_version")
|
||||||
implementation("io.ktor:ktor-server-netty-jvm")
|
implementation("io.ktor:ktor-server-netty-jvm")
|
||||||
@@ -52,6 +52,21 @@ dependencies {
|
|||||||
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
|
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ktor {
|
||||||
|
openApi {
|
||||||
|
enabled = true
|
||||||
|
codeInferenceEnabled = true
|
||||||
|
onlyCommented = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
docker {
|
docker {
|
||||||
name = "${project.name}:${project.version}"
|
name = "${project.name}:${project.version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.test {
|
||||||
|
environment("SECRET", "testsecret")
|
||||||
|
environment("ADMIN", "admin123")
|
||||||
|
environment("PORT", "8080")
|
||||||
|
systemProperty("io.ktor.development", "true")
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
ktor_version=2.3.3
|
ktor_version=3.5.1
|
||||||
kotlin_version=1.9.0
|
kotlin_version=2.4.10
|
||||||
logback_version=1.4.14
|
logback_version=1.4.14
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
exposed_version=0.43.0
|
exposed_version=0.43.0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -3,11 +3,16 @@ package de.walamana
|
|||||||
import de.walamana.plugins.*
|
import de.walamana.plugins.*
|
||||||
import de.walamana.views.*
|
import de.walamana.views.*
|
||||||
import io.github.cdimascio.dotenv.dotenv
|
import io.github.cdimascio.dotenv.dotenv
|
||||||
|
import io.ktor.http.ContentType
|
||||||
|
import io.ktor.openapi.OpenApiInfo
|
||||||
import io.ktor.server.application.*
|
import io.ktor.server.application.*
|
||||||
import io.ktor.server.engine.*
|
import io.ktor.server.engine.*
|
||||||
import io.ktor.server.http.content.*
|
import io.ktor.server.http.content.*
|
||||||
import io.ktor.server.netty.*
|
import io.ktor.server.netty.*
|
||||||
|
import io.ktor.server.plugins.swagger.swaggerUI
|
||||||
import io.ktor.server.routing.*
|
import io.ktor.server.routing.*
|
||||||
|
import io.ktor.server.routing.openapi.OpenApiDocSource
|
||||||
|
import io.ktor.utils.io.ExperimentalKtorApi
|
||||||
|
|
||||||
//fun main() {
|
//fun main() {
|
||||||
// embeddedServer(Netty, port = 8080, host = "0.0.0.0", module = Application::module)
|
// embeddedServer(Netty, port = 8080, host = "0.0.0.0", module = Application::module)
|
||||||
@@ -23,6 +28,7 @@ fun main(args: Array<String>): Unit {
|
|||||||
EngineMain.main(args)
|
EngineMain.main(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalKtorApi::class)
|
||||||
fun Application.module() {
|
fun Application.module() {
|
||||||
configureSecurity()
|
configureSecurity()
|
||||||
configureHTTP()
|
configureHTTP()
|
||||||
@@ -31,7 +37,7 @@ fun Application.module() {
|
|||||||
|
|
||||||
routing {
|
routing {
|
||||||
singlePageApplication {
|
singlePageApplication {
|
||||||
vue(System.getenv("FRONTEND_PATH"))
|
vue(System.getenv("FRONTEND_PATH") ?: "")
|
||||||
}
|
}
|
||||||
route("/api") {
|
route("/api") {
|
||||||
configureMinistrantenRoutes()
|
configureMinistrantenRoutes()
|
||||||
@@ -40,5 +46,12 @@ fun Application.module() {
|
|||||||
configurePlanRoutes()
|
configurePlanRoutes()
|
||||||
configureAuthenticationRoutes()
|
configureAuthenticationRoutes()
|
||||||
}
|
}
|
||||||
|
swaggerUI("/docs") {
|
||||||
|
info = OpenApiInfo("Ministranten App API", "1.0")
|
||||||
|
remotePath = "openapi.json"
|
||||||
|
source = OpenApiDocSource.Routing(ContentType.Application.Json) {
|
||||||
|
routingRoot.descendants()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,6 +45,14 @@ object MarksDao {
|
|||||||
}.resultedValues?.isNotEmpty() ?: false
|
}.resultedValues?.isNotEmpty() ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun setMarks(marks: List<Mark>) = dbQuery {
|
||||||
|
Marks.batchUpsert(marks) { mark ->
|
||||||
|
this[Marks.mid] = mark.mid
|
||||||
|
this[Marks.gid] = mark.gid
|
||||||
|
this[Marks.value] = mark.value
|
||||||
|
}.isNotEmpty() ?: false
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun removeMark(ministrantId: Int, gottesdienstId: Int): Boolean = dbQuery {
|
suspend fun removeMark(ministrantId: Int, gottesdienstId: Int): Boolean = dbQuery {
|
||||||
Marks.deleteWhere {
|
Marks.deleteWhere {
|
||||||
(Marks.gid eq gottesdienstId) and
|
(Marks.gid eq gottesdienstId) and
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package de.walamana.models
|
package de.walamana.models
|
||||||
|
|
||||||
|
import at.favre.lib.crypto.bcrypt.BCrypt
|
||||||
import de.walamana.plugins.*
|
import de.walamana.plugins.*
|
||||||
import kotlinx.serialization.Contextual
|
import kotlinx.serialization.Contextual
|
||||||
import kotlinx.serialization.KSerializer
|
import kotlinx.serialization.KSerializer
|
||||||
@@ -101,16 +102,28 @@ object MinistrantenDao {
|
|||||||
) = dbQuery {
|
) = dbQuery {
|
||||||
val statement = Ministranten.insert {
|
val statement = Ministranten.insert {
|
||||||
it[Ministranten.username] = username
|
it[Ministranten.username] = username
|
||||||
it[Ministranten.passwordHash] = ""
|
it[Ministranten.passwordHash] = BCrypt.withDefaults()
|
||||||
|
.hashToString(SALT_ROUNDS, passwordHash.toCharArray())
|
||||||
it[Ministranten.firstname] = firstname
|
it[Ministranten.firstname] = firstname
|
||||||
it[Ministranten.lastname] = lastname
|
it[Ministranten.lastname] = lastname
|
||||||
it[Ministranten.birthday] = birthday?.time
|
it[Ministranten.birthday] = birthday?.time
|
||||||
it[Ministranten.privileges] = privileges.joinToString(",")
|
it[Ministranten.privileges] = privileges.joinToString(",")
|
||||||
}
|
}
|
||||||
Security.setPassword(username, passwordHash)
|
|
||||||
statement.resultedValues?.singleOrNull()?.let(::resultRowToMinistrant)
|
statement.resultedValues?.singleOrNull()?.let(::resultRowToMinistrant)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getMinistrantById(id: Int): Ministrant? = dbQuery {
|
||||||
|
Ministranten.select(Ministranten.id eq id).map {
|
||||||
|
resultRowToMinistrant(it)
|
||||||
|
}.firstOrNull()
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getMinistrantenById(ids: List<Int>): List<Ministrant> = dbQuery {
|
||||||
|
Ministranten.select { Ministranten.id inList ids }.map {
|
||||||
|
resultRowToMinistrant(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun deleteMinistrant(id: Int): Boolean = dbQuery {
|
suspend fun deleteMinistrant(id: Int): Boolean = dbQuery {
|
||||||
Ministranten.deleteWhere { Ministranten.id eq id } > 0
|
Ministranten.deleteWhere { Ministranten.id eq id } > 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package de.walamana.plugins
|
|||||||
import at.favre.lib.crypto.bcrypt.BCrypt
|
import at.favre.lib.crypto.bcrypt.BCrypt
|
||||||
import com.auth0.jwt.JWT
|
import com.auth0.jwt.JWT
|
||||||
import com.auth0.jwt.algorithms.Algorithm
|
import com.auth0.jwt.algorithms.Algorithm
|
||||||
|
import com.auth0.jwt.interfaces.Claim
|
||||||
import com.auth0.jwt.interfaces.Payload
|
import com.auth0.jwt.interfaces.Payload
|
||||||
import de.walamana.models.Ministrant
|
import de.walamana.models.Ministrant
|
||||||
import de.walamana.models.MinistrantenDao
|
import de.walamana.models.MinistrantenDao
|
||||||
@@ -13,7 +14,7 @@ import io.ktor.server.auth.jwt.*
|
|||||||
import io.ktor.server.response.*
|
import io.ktor.server.response.*
|
||||||
import io.ktor.server.routing.*
|
import io.ktor.server.routing.*
|
||||||
import io.ktor.server.sessions.*
|
import io.ktor.server.sessions.*
|
||||||
import java.util.*
|
import java.util.Date
|
||||||
|
|
||||||
|
|
||||||
const val SALT_ROUNDS = 10;
|
const val SALT_ROUNDS = 10;
|
||||||
@@ -56,6 +57,22 @@ fun Application.getJWTEnvironment(): JWTEnvironment {
|
|||||||
|
|
||||||
fun Payload.username() = getClaim("username").asString()
|
fun Payload.username() = getClaim("username").asString()
|
||||||
fun Payload.mid() = getClaim("id").asInt()
|
fun Payload.mid() = getClaim("id").asInt()
|
||||||
|
fun Payload.privileges(): List<String> {
|
||||||
|
val claim = getClaim("privileges")
|
||||||
|
return if (claim.isNull || claim.asList(String::class.java).isNullOrEmpty()) emptyList() else claim.asList(String::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Payload.canAccessMinistrant(username: String): Boolean {
|
||||||
|
return this.username() == "admin" || this.privileges().contains(username)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Payload.canAccessMinistranten(usernames: List<String>): Boolean {
|
||||||
|
for (username in usernames) {
|
||||||
|
if(!canAccessMinistrant(username))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
object Security {
|
object Security {
|
||||||
|
|||||||
@@ -25,14 +25,6 @@ fun Application.configureSerialization() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
routing {
|
|
||||||
get("/json/kotlinx-serialization") {
|
|
||||||
println("Test")
|
|
||||||
// call.respond("Test")
|
|
||||||
call.respond(mapOf("hello" to "world"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typealias CommaSeperatedStringList = @Serializable(StringListAsCommaSeperatedString::class) List<String>;
|
typealias CommaSeperatedStringList = @Serializable(StringListAsCommaSeperatedString::class) List<String>;
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import io.ktor.server.auth.jwt.*
|
|||||||
import io.ktor.server.request.*
|
import io.ktor.server.request.*
|
||||||
import io.ktor.server.response.*
|
import io.ktor.server.response.*
|
||||||
import io.ktor.server.routing.*
|
import io.ktor.server.routing.*
|
||||||
|
import io.ktor.server.routing.openapi.describe
|
||||||
|
import io.ktor.utils.io.ExperimentalKtorApi
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
@@ -44,6 +46,7 @@ data class PasswordResetRequest(
|
|||||||
val username: String
|
val username: String
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@OptIn(ExperimentalKtorApi::class)
|
||||||
fun Route.configureAuthenticationRoutes() {
|
fun Route.configureAuthenticationRoutes() {
|
||||||
route("/auth") {
|
route("/auth") {
|
||||||
post {
|
post {
|
||||||
@@ -122,5 +125,7 @@ fun Route.configureAuthenticationRoutes() {
|
|||||||
call.respond(AuthenticationResult(true, newToken, ministrant.privileges))
|
call.respond(AuthenticationResult(true, newToken, ministrant.privileges))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}.describe {
|
||||||
|
tag("Authentication")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,22 +2,33 @@ package de.walamana.views
|
|||||||
|
|
||||||
import de.walamana.models.Gottesdienst
|
import de.walamana.models.Gottesdienst
|
||||||
import de.walamana.models.GottesdiensteDao
|
import de.walamana.models.GottesdiensteDao
|
||||||
|
import de.walamana.plugins.getJWTEnvironment
|
||||||
|
import de.walamana.plugins.username
|
||||||
import de.walamana.service.ZelebrationsplanParser
|
import de.walamana.service.ZelebrationsplanParser
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import io.ktor.http.content.*
|
import io.ktor.http.content.*
|
||||||
import io.ktor.server.application.*
|
import io.ktor.server.application.*
|
||||||
|
import io.ktor.server.auth.*
|
||||||
|
import io.ktor.server.auth.jwt.*
|
||||||
import io.ktor.server.request.*
|
import io.ktor.server.request.*
|
||||||
import io.ktor.server.response.*
|
import io.ktor.server.response.*
|
||||||
import io.ktor.server.routing.*
|
import io.ktor.server.routing.*
|
||||||
|
import io.ktor.server.routing.openapi.describe
|
||||||
import io.ktor.server.util.*
|
import io.ktor.server.util.*
|
||||||
|
import io.ktor.utils.io.ExperimentalKtorApi
|
||||||
|
|
||||||
|
@OptIn(ExperimentalKtorApi::class)
|
||||||
fun Route.configureGottesdiensteRoutes() {
|
fun Route.configureGottesdiensteRoutes() {
|
||||||
|
authenticate {
|
||||||
route("/gottesdienste") {
|
route("/gottesdienste") {
|
||||||
get {
|
get {
|
||||||
|
val principal = call.principal<JWTPrincipal>() ?: return@get call.respond(HttpStatusCode.Unauthorized)
|
||||||
val data = GottesdiensteDao.allGottesdienste()
|
val data = GottesdiensteDao.allGottesdienste()
|
||||||
call.respond(data)
|
call.respond(data)
|
||||||
}
|
}
|
||||||
put {
|
put {
|
||||||
|
val principal = call.principal<JWTPrincipal>() ?: return@put call.respond(HttpStatusCode.Unauthorized)
|
||||||
|
if (principal.payload.username() != "admin") return@put call.respond(HttpStatusCode.Forbidden, mapOf("msg" to "Nur Admin kann Gottesdienste erstellen"))
|
||||||
val data = call.receive<Gottesdienst>()
|
val data = call.receive<Gottesdienst>()
|
||||||
val gottesdienst = GottesdiensteDao.createGottesdienst(
|
val gottesdienst = GottesdiensteDao.createGottesdienst(
|
||||||
data.name,
|
data.name,
|
||||||
@@ -28,7 +39,8 @@ fun Route.configureGottesdiensteRoutes() {
|
|||||||
call.respond(mapOf("id" to gottesdienst?.id))
|
call.respond(mapOf("id" to gottesdienst?.id))
|
||||||
}
|
}
|
||||||
patch {
|
patch {
|
||||||
// TODO: Access only by admin
|
val principal = call.principal<JWTPrincipal>() ?: return@patch call.respond(HttpStatusCode.Unauthorized)
|
||||||
|
if (principal.payload.username() != "admin") return@patch call.respond(HttpStatusCode.Forbidden, mapOf("msg" to "Nur Admin kann Gottesdienste aktualisieren"))
|
||||||
val data = call.receive<Gottesdienst>()
|
val data = call.receive<Gottesdienst>()
|
||||||
val changed = GottesdiensteDao.updateGottesdienst(
|
val changed = GottesdiensteDao.updateGottesdienst(
|
||||||
data.id,
|
data.id,
|
||||||
@@ -40,12 +52,16 @@ fun Route.configureGottesdiensteRoutes() {
|
|||||||
call.respond(HttpStatusCode.OK)
|
call.respond(HttpStatusCode.OK)
|
||||||
}
|
}
|
||||||
delete {
|
delete {
|
||||||
val id = call.request.queryParameters["id"]?.toInt() ?: TODO("fail")
|
val principal = call.principal<JWTPrincipal>() ?: return@delete call.respond(HttpStatusCode.Unauthorized)
|
||||||
|
if (principal.payload.username() != "admin") return@delete call.respond(HttpStatusCode.Forbidden, mapOf("msg" to "Nur Admin kann Gottesdienste löschen"))
|
||||||
|
val id = call.request.queryParameters["id"]?.toInt() ?: return@delete call.respond(HttpStatusCode.BadRequest, mapOf("msg" to "Missing id parameter"))
|
||||||
GottesdiensteDao.deleteGottesdienst(id)
|
GottesdiensteDao.deleteGottesdienst(id)
|
||||||
call.respond(HttpStatusCode.OK)
|
call.respond(HttpStatusCode.OK)
|
||||||
}
|
}
|
||||||
|
|
||||||
post("/parseZelebrationsplan") {
|
post("/parseZelebrationsplan") {
|
||||||
|
val principal = call.principal<JWTPrincipal>() ?: return@post call.respond(HttpStatusCode.Unauthorized)
|
||||||
|
if (principal.payload.username() != "admin") return@post call.respond(HttpStatusCode.Forbidden, mapOf("msg" to "Nur Admin kann Pläne hochladen"))
|
||||||
val id = call.parameters.getOrFail("id").toInt()
|
val id = call.parameters.getOrFail("id").toInt()
|
||||||
val multipartData = call.receiveMultipart()
|
val multipartData = call.receiveMultipart()
|
||||||
multipartData.forEachPart { part ->
|
multipartData.forEachPart { part ->
|
||||||
@@ -56,5 +72,8 @@ fun Route.configureGottesdiensteRoutes() {
|
|||||||
part.dispose()
|
part.dispose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}.describe {
|
||||||
|
tag("Gottesdienste")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,46 +1,75 @@
|
|||||||
package de.walamana.views
|
package de.walamana.views
|
||||||
|
|
||||||
import de.walamana.models.*
|
import de.walamana.models.*
|
||||||
|
import de.walamana.plugins.canAccessMinistrant
|
||||||
|
import de.walamana.plugins.canAccessMinistranten
|
||||||
|
import de.walamana.plugins.mid
|
||||||
|
import de.walamana.plugins.username
|
||||||
|
import de.walamana.service.PlanDao
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import io.ktor.server.application.*
|
import io.ktor.server.application.*
|
||||||
|
import io.ktor.server.auth.*
|
||||||
|
import io.ktor.server.auth.jwt.*
|
||||||
import io.ktor.server.request.*
|
import io.ktor.server.request.*
|
||||||
import io.ktor.server.response.*
|
import io.ktor.server.response.*
|
||||||
import io.ktor.server.routing.*
|
import io.ktor.server.routing.*
|
||||||
|
import io.ktor.server.routing.openapi.describe
|
||||||
import io.ktor.server.util.*
|
import io.ktor.server.util.*
|
||||||
|
import io.ktor.utils.io.ExperimentalKtorApi
|
||||||
|
|
||||||
|
|
||||||
|
@OptIn(ExperimentalKtorApi::class)
|
||||||
fun Route.configureMarksView() {
|
fun Route.configureMarksView() {
|
||||||
|
authenticate {
|
||||||
route("/marks") {
|
route("/marks") {
|
||||||
get {
|
get {
|
||||||
val data = MarksDao.allMarksForPlan(call.receiveParameters().getOrFail("id").toInt())
|
val principal = call.principal<JWTPrincipal>() ?: return@get call.respond(HttpStatusCode.Unauthorized)
|
||||||
|
val planId = call.request.queryParameters["id"]?.toInt()
|
||||||
|
?: return@get call.respond(HttpStatusCode.BadRequest, mapOf("msg" to "Missing id parameter"))
|
||||||
|
val plan = PlanDao.constructPlan(planId, isAnonymous = false)
|
||||||
|
val data = MarksDao.allMarksForPlan(planId)
|
||||||
call.respond(data)
|
call.respond(data)
|
||||||
}
|
}
|
||||||
put {
|
patch {
|
||||||
|
val principal = call.principal<JWTPrincipal>() ?: return@patch call.respond(HttpStatusCode.Unauthorized)
|
||||||
val changedMarks = call.receive<List<Mark>>()
|
val changedMarks = call.receive<List<Mark>>()
|
||||||
for(changedMark in changedMarks) {
|
val ministrantenIds = changedMarks.map { it.mid }.distinct()
|
||||||
val mark = MarksDao.setMark(
|
val ministrantenUsernames = MinistrantenDao.getMinistrantenById(ministrantenIds).map { it.username }
|
||||||
changedMark.mid,
|
if (ministrantenUsernames.size != ministrantenIds.size) {
|
||||||
changedMark.gid,
|
return@patch call.respond(
|
||||||
changedMark.value
|
HttpStatusCode.BadRequest,
|
||||||
|
mapOf("msg" to "Es wurden ungültige Ministranten IDs angegeben.")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
call.respond(HttpStatusCode.OK)
|
if (!principal.payload.canAccessMinistranten(ministrantenUsernames)) {
|
||||||
|
return@patch call.respond(
|
||||||
|
HttpStatusCode.Forbidden,
|
||||||
|
mapOf("msg" to "Sie haben keine Berechtigung für diese Ministrianten")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
patch {
|
if (!MarksDao.setMarks(changedMarks)) {
|
||||||
// TODO: Access only by admin
|
return@patch call.respond(
|
||||||
val changedMarks = call.receive<List<Mark>>()
|
HttpStatusCode.InternalServerError,
|
||||||
for(changedMark in changedMarks) {
|
mapOf("msg" to "Server konnte Änderungen nicht speichern")
|
||||||
val mark = MarksDao.setMark(
|
|
||||||
changedMark.mid,
|
|
||||||
changedMark.gid,
|
|
||||||
changedMark.value
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
call.respond(HttpStatusCode.OK)
|
call.respond(HttpStatusCode.OK)
|
||||||
}
|
}
|
||||||
delete {
|
delete {
|
||||||
GottesdiensteDao.deleteGottesdienst(call.receiveParameters().getOrFail("id").toInt())
|
val principal = call.principal<JWTPrincipal>() ?: return@delete call.respond(HttpStatusCode.Unauthorized)
|
||||||
|
val ministerId = call.request.queryParameters["mid"]?.toInt() ?: return@delete call.respond(HttpStatusCode.BadRequest, mapOf("msg" to "Missing mid parameter"))
|
||||||
|
val gottesdienstId = call.request.queryParameters["gid"]?.toInt() ?: return@delete call.respond(HttpStatusCode.BadRequest, mapOf("msg" to "Missing gid parameter"))
|
||||||
|
val ministantUsername = if (ministerId == 0) "admin" else {
|
||||||
|
MinistrantenDao.getMinistrantById(ministerId)?.username ?: return@delete call.respond(HttpStatusCode.BadRequest, mapOf("msg" to "Ungültige Ministrianten-ID"))
|
||||||
|
}
|
||||||
|
if (!principal.payload.canAccessMinistrant(ministantUsername)) {
|
||||||
|
return@delete call.respond(HttpStatusCode.Forbidden, mapOf("msg" to "Sie haben keine Berechtigung für diese Ministrianten"))
|
||||||
|
}
|
||||||
|
MarksDao.removeMark(ministerId, gottesdienstId)
|
||||||
call.respond(HttpStatusCode.OK)
|
call.respond(HttpStatusCode.OK)
|
||||||
}
|
}
|
||||||
|
}.describe {
|
||||||
|
tag("Marks")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,21 +3,31 @@ package de.walamana.views
|
|||||||
import de.walamana.models.Ministrant
|
import de.walamana.models.Ministrant
|
||||||
import de.walamana.models.MinistrantenDao
|
import de.walamana.models.MinistrantenDao
|
||||||
import de.walamana.models.SimplifiedMinistrant
|
import de.walamana.models.SimplifiedMinistrant
|
||||||
|
import de.walamana.plugins.username
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import io.ktor.server.application.*
|
import io.ktor.server.application.*
|
||||||
|
import io.ktor.server.auth.*
|
||||||
|
import io.ktor.server.auth.jwt.*
|
||||||
import io.ktor.server.request.*
|
import io.ktor.server.request.*
|
||||||
import io.ktor.server.response.*
|
import io.ktor.server.response.*
|
||||||
import io.ktor.server.routing.*
|
import io.ktor.server.routing.*
|
||||||
|
import io.ktor.server.routing.openapi.describe
|
||||||
import io.ktor.server.util.*
|
import io.ktor.server.util.*
|
||||||
|
import io.ktor.utils.io.ExperimentalKtorApi
|
||||||
|
|
||||||
|
@ExperimentalKtorApi
|
||||||
fun Route.configureMinistrantenRoutes() {
|
fun Route.configureMinistrantenRoutes() {
|
||||||
|
authenticate {
|
||||||
route("/ministranten") {
|
route("/ministranten") {
|
||||||
get {
|
get {
|
||||||
|
call.principal<JWTPrincipal>() ?: return@get call.respond(HttpStatusCode.Unauthorized)
|
||||||
val data = MinistrantenDao.allMinistranten();
|
val data = MinistrantenDao.allMinistranten();
|
||||||
call.respond(data)
|
call.respond(data)
|
||||||
}
|
}
|
||||||
put {
|
put {
|
||||||
|
val principal = call.principal<JWTPrincipal>() ?: return@put call.respond(HttpStatusCode.Unauthorized)
|
||||||
val data = call.receive<Ministrant>()
|
val data = call.receive<Ministrant>()
|
||||||
|
if (principal.payload.username() != "admin") return@put call.respond(HttpStatusCode.Forbidden, mapOf("msg" to "Nur Admin kann Ministrianten erstellen"))
|
||||||
val passwordHash = data.passwordHash ?: return@put
|
val passwordHash = data.passwordHash ?: return@put
|
||||||
val ministrant = MinistrantenDao.createMinistrant(
|
val ministrant = MinistrantenDao.createMinistrant(
|
||||||
data.username,
|
data.username,
|
||||||
@@ -30,11 +40,12 @@ fun Route.configureMinistrantenRoutes() {
|
|||||||
call.respond(mapOf("id" to ministrant?.id))
|
call.respond(mapOf("id" to ministrant?.id))
|
||||||
}
|
}
|
||||||
patch {
|
patch {
|
||||||
// TODO: Access only by admin
|
val principal = call.principal<JWTPrincipal>() ?: return@patch call.respond(HttpStatusCode.Unauthorized)
|
||||||
|
if (principal.payload.username() != "admin") return@patch call.respond(HttpStatusCode.Forbidden, mapOf("msg" to "Nur Admin kann Ministrianten aktualisieren"))
|
||||||
val simple = false
|
val simple = false
|
||||||
if(simple) {
|
if(simple) {
|
||||||
val data = call.receive<SimplifiedMinistrant>()
|
val data = call.receive<SimplifiedMinistrant>()
|
||||||
val changed = MinistrantenDao.updateMinistrant(
|
MinistrantenDao.updateMinistrant(
|
||||||
id = data.id,
|
id = data.id,
|
||||||
username = data.username,
|
username = data.username,
|
||||||
firstname = data.firstname,
|
firstname = data.firstname,
|
||||||
@@ -42,7 +53,7 @@ fun Route.configureMinistrantenRoutes() {
|
|||||||
)
|
)
|
||||||
}else{
|
}else{
|
||||||
val data = call.receive<Ministrant>()
|
val data = call.receive<Ministrant>()
|
||||||
val changed = MinistrantenDao.updateMinistrant(
|
MinistrantenDao.updateMinistrant(
|
||||||
data.id,
|
data.id,
|
||||||
data.username,
|
data.username,
|
||||||
null,
|
null,
|
||||||
@@ -55,9 +66,14 @@ fun Route.configureMinistrantenRoutes() {
|
|||||||
call.respond(HttpStatusCode.OK)
|
call.respond(HttpStatusCode.OK)
|
||||||
}
|
}
|
||||||
delete {
|
delete {
|
||||||
val id = call.request.queryParameters["id"]?.toInt() ?: TODO("fail")
|
val principal = call.principal<JWTPrincipal>() ?: return@delete call.respond(HttpStatusCode.Unauthorized)
|
||||||
|
if (principal.payload.username() != "admin") return@delete call.respond(HttpStatusCode.Forbidden, mapOf("msg" to "Nur Admin kann Ministrianten löschen"))
|
||||||
|
val id = call.request.queryParameters["id"]?.toInt() ?: return@delete call.respond(HttpStatusCode.BadRequest, mapOf("msg" to "Missing id parameter"))
|
||||||
MinistrantenDao.deleteMinistrant(id)
|
MinistrantenDao.deleteMinistrant(id)
|
||||||
call.respond(HttpStatusCode.OK)
|
call.respond(HttpStatusCode.OK)
|
||||||
}
|
}
|
||||||
|
}.describe {
|
||||||
|
tag("Ministranten")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,16 +3,20 @@ package de.walamana.views
|
|||||||
import de.walamana.models.GottesdienstGroup
|
import de.walamana.models.GottesdienstGroup
|
||||||
import de.walamana.models.GottesdienstGroupDao
|
import de.walamana.models.GottesdienstGroupDao
|
||||||
import de.walamana.models.GottesdienstGroups
|
import de.walamana.models.GottesdienstGroups
|
||||||
import de.walamana.plugins.getJWTEnvironment
|
import de.walamana.plugins.username
|
||||||
import de.walamana.service.PlanDao
|
import de.walamana.service.PlanDao
|
||||||
|
import io.ktor.http.*
|
||||||
import io.ktor.server.application.*
|
import io.ktor.server.application.*
|
||||||
import io.ktor.server.auth.*
|
import io.ktor.server.auth.*
|
||||||
import io.ktor.server.auth.jwt.*
|
import io.ktor.server.auth.jwt.*
|
||||||
import io.ktor.server.request.*
|
import io.ktor.server.request.*
|
||||||
import io.ktor.server.response.*
|
import io.ktor.server.response.*
|
||||||
import io.ktor.server.routing.*
|
import io.ktor.server.routing.*
|
||||||
|
import io.ktor.server.routing.openapi.describe
|
||||||
import io.ktor.server.util.*
|
import io.ktor.server.util.*
|
||||||
|
import io.ktor.utils.io.ExperimentalKtorApi
|
||||||
|
|
||||||
|
@OptIn(ExperimentalKtorApi::class)
|
||||||
fun Route.configurePlanRoutes() {
|
fun Route.configurePlanRoutes() {
|
||||||
route("/plan") {
|
route("/plan") {
|
||||||
authenticate {
|
authenticate {
|
||||||
@@ -24,28 +28,42 @@ fun Route.configurePlanRoutes() {
|
|||||||
call.respond(plan)
|
call.respond(plan)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}.describe {
|
||||||
|
tag("Plan")
|
||||||
}
|
}
|
||||||
route("/groups") {
|
route("/groups") {
|
||||||
|
authenticate {
|
||||||
get {
|
get {
|
||||||
|
val principal = call.principal<JWTPrincipal>() ?: return@get call.respond(HttpStatusCode.Unauthorized)
|
||||||
|
if (principal.payload.username() != "admin") return@get call.respond(HttpStatusCode.Forbidden, mapOf("msg" to "Nur Admin kann Gruppen abfragen"))
|
||||||
val offset = call.parameters.get("offset")?.toLong() ?: 0
|
val offset = call.parameters.get("offset")?.toLong() ?: 0
|
||||||
val amount = call.parameters.get("amount")?.toInt() ?: 10
|
val amount = call.parameters.get("amount")?.toInt() ?: 10
|
||||||
val groups = GottesdienstGroupDao.getPlans(amount, offset)
|
val groups = GottesdienstGroupDao.getPlans(amount, offset)
|
||||||
call.respond(groups)
|
call.respond(groups)
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
|
val principal = call.principal<JWTPrincipal>() ?: return@post call.respond(HttpStatusCode.Unauthorized)
|
||||||
|
if (principal.payload.username() != "admin") return@post call.respond(HttpStatusCode.Forbidden, mapOf("msg" to "Nur Admin kann Gruppen erstellen"))
|
||||||
val group = call.receive<GottesdienstGroup>()
|
val group = call.receive<GottesdienstGroup>()
|
||||||
val res = GottesdienstGroupDao.createPlan(group.from, group.to) ?: TODO("fail")
|
val res = GottesdienstGroupDao.createPlan(group.from, group.to) ?: TODO("fail")
|
||||||
call.respond(res)
|
call.respond(res)
|
||||||
}
|
}
|
||||||
patch {
|
patch {
|
||||||
|
val principal = call.principal<JWTPrincipal>() ?: return@patch call.respond(HttpStatusCode.Unauthorized)
|
||||||
|
if (principal.payload.username() != "admin") return@patch call.respond(HttpStatusCode.Forbidden, mapOf("msg" to "Nur Admin kann Gruppen aktualisieren"))
|
||||||
val group = call.receive<GottesdienstGroup>()
|
val group = call.receive<GottesdienstGroup>()
|
||||||
val res = GottesdienstGroupDao.updatePlan(group) ?: TODO("fail")
|
val res = GottesdienstGroupDao.updatePlan(group) ?: TODO("fail")
|
||||||
call.respond(res)
|
call.respond(res)
|
||||||
}
|
}
|
||||||
delete {
|
delete {
|
||||||
|
val principal = call.principal<JWTPrincipal>() ?: return@delete call.respond(HttpStatusCode.Unauthorized)
|
||||||
|
if (principal.payload.username() != "admin") return@delete call.respond(HttpStatusCode.Forbidden, mapOf("msg" to "Nur Admin kann Gruppen löschen"))
|
||||||
val id = call.parameters.getOrFail("id").toInt()
|
val id = call.parameters.getOrFail("id").toInt()
|
||||||
val res = GottesdienstGroupDao.deletePlan(id)
|
val res = GottesdienstGroupDao.deletePlan(id)
|
||||||
call.respond(hashMapOf("success" to res))
|
call.respond(hashMapOf("success" to res))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}.describe {
|
||||||
|
tag("Plan")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,118 @@
|
|||||||
package de.walamana
|
package de.walamana
|
||||||
|
|
||||||
import de.walamana.plugins.*
|
import de.walamana.models.Gottesdienst
|
||||||
|
import de.walamana.models.GottesdienstGroup
|
||||||
|
import de.walamana.models.Mark
|
||||||
|
import de.walamana.models.Ministrant
|
||||||
|
import de.walamana.views.AuthenticationRequest
|
||||||
|
import de.walamana.views.AuthenticationResult
|
||||||
import io.ktor.client.request.*
|
import io.ktor.client.request.*
|
||||||
import io.ktor.client.statement.*
|
import io.ktor.client.statement.*
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import io.ktor.server.testing.*
|
import io.ktor.server.testing.*
|
||||||
import kotlin.test.*
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.jsonObject
|
||||||
|
import java.util.Date
|
||||||
|
import kotlin.test.Test
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
import kotlin.test.assertNotNull
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class ApplicationTest {
|
class ApplicationTest {
|
||||||
// @Test
|
private val json = Json { ignoreUnknownKeys = true }
|
||||||
// fun testRoot() = testApplication {
|
|
||||||
// application {
|
@Test
|
||||||
// configureRouting()
|
fun `admin can manage a plan and regular users remain restricted`() = testApplication {
|
||||||
// }
|
environment {
|
||||||
// client.get("/").apply {
|
config = io.ktor.server.config.ApplicationConfig("application.conf")
|
||||||
// assertEquals(HttpStatusCode.OK, status)
|
}
|
||||||
// assertEquals("Hello World!", bodyAsText())
|
|
||||||
// }
|
fun authenticated(token: String) = "Bearer $token"
|
||||||
// }
|
|
||||||
|
val adminToken = client.post("/api/auth") {
|
||||||
|
contentType(ContentType.Application.Json)
|
||||||
|
setBody(json.encodeToString(AuthenticationRequest("admin", "admin123")))
|
||||||
|
}.let { response ->
|
||||||
|
assertEquals(HttpStatusCode.OK, response.status)
|
||||||
|
val result = json.decodeFromString<AuthenticationResult>(response.bodyAsText())
|
||||||
|
assertTrue(result.success)
|
||||||
|
assertNotNull(result.token)
|
||||||
|
}
|
||||||
|
|
||||||
|
client.get("/api/groups").also {
|
||||||
|
assertEquals(HttpStatusCode.Unauthorized, it.status)
|
||||||
|
}
|
||||||
|
|
||||||
|
val now = System.currentTimeMillis()
|
||||||
|
val group = client.post("/api/groups") {
|
||||||
|
header(HttpHeaders.Authorization, authenticated(adminToken))
|
||||||
|
contentType(ContentType.Application.Json)
|
||||||
|
setBody(json.encodeToString(GottesdienstGroup(-1, Date(now), Date(now + 86_400_000))))
|
||||||
|
}.let { response ->
|
||||||
|
assertEquals(HttpStatusCode.OK, response.status)
|
||||||
|
json.decodeFromString<GottesdienstGroup>(response.bodyAsText())
|
||||||
|
}
|
||||||
|
assertTrue(group.id > 0)
|
||||||
|
|
||||||
|
val ministrantId = client.put("/api/ministranten") {
|
||||||
|
header(HttpHeaders.Authorization, authenticated(adminToken))
|
||||||
|
contentType(ContentType.Application.Json)
|
||||||
|
setBody(json.encodeToString(Ministrant(-1, "testuser", "password123", "Test", "User", null, emptyList())))
|
||||||
|
}.let { response ->
|
||||||
|
assertEquals(HttpStatusCode.OK, response.status)
|
||||||
|
json.parseToJsonElement(response.bodyAsText()).jsonObject["id"]!!.toString().toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
val userToken = client.post("/api/auth") {
|
||||||
|
contentType(ContentType.Application.Json)
|
||||||
|
setBody(json.encodeToString(AuthenticationRequest("testuser", "password123")))
|
||||||
|
}.let { response ->
|
||||||
|
assertEquals(HttpStatusCode.OK, response.status)
|
||||||
|
assertNotNull(json.decodeFromString<AuthenticationResult>(response.bodyAsText()).token)
|
||||||
|
}
|
||||||
|
client.get("/api/groups") {
|
||||||
|
header(HttpHeaders.Authorization, authenticated(userToken))
|
||||||
|
}.also {
|
||||||
|
assertEquals(HttpStatusCode.Forbidden, it.status)
|
||||||
|
}
|
||||||
|
|
||||||
|
val service = client.put("/api/gottesdienste") {
|
||||||
|
header(HttpHeaders.Authorization, authenticated(adminToken))
|
||||||
|
contentType(ContentType.Application.Json)
|
||||||
|
setBody(json.encodeToString(Gottesdienst(0, "Test service", Date(now), Date(now + 1_800_000), group.id)))
|
||||||
|
}.let { response ->
|
||||||
|
assertEquals(HttpStatusCode.OK, response.status)
|
||||||
|
json.parseToJsonElement(response.bodyAsText()).jsonObject["id"]!!.toString().toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
client.patch("/api/marks") {
|
||||||
|
header(HttpHeaders.Authorization, authenticated(adminToken))
|
||||||
|
contentType(ContentType.Application.Json)
|
||||||
|
setBody(json.encodeToString(listOf(Mark(ministrantId, service, 1))))
|
||||||
|
}.also {
|
||||||
|
assertEquals(HttpStatusCode.OK, it.status)
|
||||||
|
}
|
||||||
|
|
||||||
|
client.get("/api/marks?id=${group.id}") {
|
||||||
|
header(HttpHeaders.Authorization, authenticated(adminToken))
|
||||||
|
}.let { response ->
|
||||||
|
assertEquals(HttpStatusCode.OK, response.status)
|
||||||
|
assertTrue(json.decodeFromString<List<Mark>>(response.bodyAsText()).contains(Mark(ministrantId, service, 1)))
|
||||||
|
}
|
||||||
|
|
||||||
|
client.get("/api/plan?id=${group.id}") {
|
||||||
|
header(HttpHeaders.Authorization, authenticated(adminToken))
|
||||||
|
}.also {
|
||||||
|
assertEquals(HttpStatusCode.OK, it.status)
|
||||||
|
}
|
||||||
|
|
||||||
|
client.get("/docs/openapi.json").let { response ->
|
||||||
|
assertEquals(HttpStatusCode.OK, response.status)
|
||||||
|
val specification = response.bodyAsText()
|
||||||
|
assertTrue(specification.contains("\"requestBody\""))
|
||||||
|
assertTrue(specification.contains("\"responses\""))
|
||||||
|
assertTrue(specification.contains("AuthenticationRequest"))
|
||||||
|
assertTrue(specification.contains("AuthenticationResult"))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
ktor {
|
||||||
|
development = true
|
||||||
|
deployment {
|
||||||
|
port = 8080
|
||||||
|
}
|
||||||
|
application {
|
||||||
|
modules = [ de.walamana.ApplicationKt.module ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jwt {
|
||||||
|
secret = "testsecret"
|
||||||
|
issuer = "http://0.0.0.0:8080/"
|
||||||
|
audience = "http://0.0.0.0:8080/"
|
||||||
|
realm = "mini-data"
|
||||||
|
}
|
||||||
|
|
||||||
|
database {
|
||||||
|
url = "jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1"
|
||||||
|
driver = "org.h2.Driver"
|
||||||
|
}
|
||||||
|
|
||||||
|
admin {
|
||||||
|
password = "admin123"
|
||||||
|
}
|
||||||
Reference in new issue
Block a user