diff --git a/build.gradle b/build.gradle index b51cc50..63f7c4f 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { ext { jvm_version = '21' kotlin_version = '2.0.0' - gaea_version = '1.7.0' + gaea_version = '1.7.1' spring_version = "3.3.0" } @@ -26,7 +26,7 @@ subprojects { version version ext { - version '1.0.0' + version '1.1.0' } buildscript { @@ -68,4 +68,12 @@ subprojects { jvmTarget = JvmTarget.valueOf("JVM_$jvm_version") } } + + publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } + } } diff --git a/doc/db-init.js b/doc/db-init.js index dae785c..2ae7c1a 100644 --- a/doc/db-init.js +++ b/doc/db-init.js @@ -39,25 +39,16 @@ db.system.insertOne({ }) db.page.insertMany([ - { "_id": "1", "name": "groups", "uri": "/groups", "parent": "0", "system": "1", "order": 5, "icon": "group" }, - { "_id": "2", "name": "roles", "uri": "/roles", "parent": "0", "system": "1", "order": 6, "icon": "manual" }, - { "_id": "3", "name": "users", "uri": "/users", "parent": "0", "system": "1", "order": 7, "icon": "user" }, - { "_id": "4", "name": "sheet", "uri": "/repair/sheets/all", "parent": "0", "system": "1", "order": 1, "icon": "sheet" }, - { "_id": "5", "name": "sheet", "uri": "/repair/sheets/permission", "parent": "1", "system": "1", "order": 2, "icon": "sheet" }, - { "_id": "6", "name": "spare", "uri": "/repair/spares/all", "parent": "1", "system": "1", "order": 3, "icon": "setting" }, - { "_id": "7", "name": "spare", "uri": "/repair/spares/permission", "parent": "1", "system": "1", "order": 4, "icon": "setting" }, - { "_id": "8", "name": "manual", "uri": "/manual", "parent": "0", "system": "1", "order": 8, "icon": "manual" } + { "_id": "1", "name": "groups", "uri": "/groups", "parent": "0", "system": "1", "order": 1, "icon": "group" }, + { "_id": "2", "name": "roles", "uri": "/roles", "parent": "0", "system": "1", "order": 2, "icon": "manual" }, + { "_id": "3", "name": "users", "uri": "/users", "parent": "0", "system": "1", "order": 3, "icon": "user" }, + { "_id": "4", "name": "pages", "uri": "/pages", "parent": "0", "system": "1", "order": 4, "icon": "page" }}) ]) db.authority.insertMany([ { "role": "admin", "resource": "1", "type": "System", "authority": "Allow", "avalible": true, "_class": "com.synebula.zeus.domain.model.rbac.Authority" }, { "role": "admin", "resource": "1", "type": "Page", "authority": "Allow", "avalible": true, "_class": "com.synebula.zeus.domain.model.rbac.Authority" }, { "role": "admin", "resource": "2", "type": "Page", "authority": "Allow", "avalible": true, "_class": "com.synebula.zeus.domain.model.rbac.Authority" }, - { "role": "admin", "resource": "3", "type": "Page", "authority": "Allow", "avalible": true, "_class": "com.synebula.zeus.domain.model.rbac.Authority" }, - { "role": "admin", "resource": "4", "type": "Page", "authority": "Allow", "avalible": true, "_class": "com.synebula.zeus.domain.model.rbac.Authority" }, - { "role": "admin", "resource": "5", "type": "Page", "authority": "Allow", "avalible": true, "_class": "com.synebula.zeus.domain.model.rbac.Authority" }, - { "role": "admin", "resource": "6", "type": "Page", "authority": "Allow", "avalible": true, "_class": "com.synebula.zeus.domain.model.rbac.Authority" }, - { "role": "admin", "resource": "7", "type": "Page", "authority": "Allow", "avalible": true, "_class": "com.synebula.zeus.domain.model.rbac.Authority" }, - { "role": "admin", "resource": "8", "type": "Page", "authority": "Allow", "avalible": true, "_class": "com.synebula.zeus.domain.model.rbac.Authority" }, + { "role": "admin", "resource": "67595cfcbbef24782f95a325", "type": "Page", "authority": "Allow", "avalible": true, "_class": "com.synebula.zeus.domain.model.rbac.Authority" }, ]) diff --git a/src/zeus.app/build.gradle b/src/zeus.app/build.gradle index fc92b72..fc79691 100644 --- a/src/zeus.app/build.gradle +++ b/src/zeus.app/build.gradle @@ -18,16 +18,4 @@ dependencies { api "com.synebula:gaea.spring:$gaea_version" api "com.synebula:gaea.mongodb:$gaea_version" -} - -publishing { - publications { - publish(MavenPublication) { - group 'com.synebula' - artifactId 'zeus.app' - version "$version" - from components.java - } - } -} - +} \ No newline at end of file diff --git a/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/SignInOutApp.kt b/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/SignInOutApp.kt index 0a63fcb..764ddab 100644 --- a/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/SignInOutApp.kt +++ b/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/SignInOutApp.kt @@ -66,12 +66,12 @@ class SignInOutApp(override var logger: ILogger) : IApplication { @Method("用户登出") @PostMapping("/out") fun signOut(): HttpMessage { - val token = this.userSession()?.token + val token = this.session()?.token return if (token != null) { userSessionManager.signOut(token) this.httpMessageFactory.create(token) } else - this.httpMessageFactory.create(Status.Unauthorized, "") + this.httpMessageFactory.create(Status.UNAUTHORIZED, "") } @Method("用户注册") @@ -83,7 +83,7 @@ class SignInOutApp(override var logger: ILogger) : IApplication { val message = userService.add(command) it.data = message.data } else { - it.status = Status.Failure + it.status = Status.FAILURE it.message = "系统中已存在该用户" } } diff --git a/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/UserApp.kt b/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/UserApp.kt index 1e271a9..b68b75c 100644 --- a/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/UserApp.kt +++ b/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/UserApp.kt @@ -31,7 +31,7 @@ class UserApp( if (list.isEmpty()) it.from(super.add(command)) else { - it.status = Status.Failure + it.status = Status.FAILURE it.message = "系统中已存在该用户" } } @@ -58,7 +58,7 @@ class UserApp( it.load((this.service as IUserService).forgotPassword(users[0].id)) } else { - it.status = Status.Failure + it.status = Status.FAILURE it.message = "找不到该用户信息" } } diff --git a/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/resource/PageApp.kt b/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/resource/PageApp.kt index 7e586a4..0644bf7 100644 --- a/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/resource/PageApp.kt +++ b/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/resource/PageApp.kt @@ -8,6 +8,7 @@ import com.synebula.gaea.spring.aop.annotation.Module import com.synebula.zeus.domain.service.cmd.rbac.resource.PageCmd import com.synebula.zeus.domain.service.contr.rbac.resource.IPageService import com.synebula.zeus.query.contr.resouce.IPageQuery +import com.synebula.zeus.query.view.SignUserView import com.synebula.zeus.query.view.resource.PageView import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PathVariable @@ -26,11 +27,11 @@ class PageApp( ) { @Method("获取角色系统下有权页面") - @GetMapping("/in-system/{system}/authorized/{role}") + @GetMapping("/by-system/{system}/authorized/{role}") fun authorized(@PathVariable system: String, @PathVariable role: String): HttpMessage { - val msg = this.httpMessageFactory.create() - msg.data = this.pageQuery.authorized(role, system) - return msg + return this.safeExecute("获取有权资源列表失败") { msg -> + msg.data = this.pageQuery.authorized(role, system) + } } @Method("获取角色全部有权页面") @@ -42,20 +43,22 @@ class PageApp( } @Method("验证角色页面权限") - @GetMapping("/{page}/authorize/{role}") - fun authorize(@PathVariable page: String, @PathVariable role: String): HttpMessage { + @GetMapping("/{page}/authorize") + fun authorize(@PathVariable page: String): HttpMessage { + val session = this.session() + val rid = session?.user()?.rid ?: "" return this.safeExecute("获取权限信息失败") { msg -> - msg.data = this.pageQuery.authorize(page, role) + msg.data = this.pageQuery.authorize(page, rid) } } @Method("验证角色URL权限") - @GetMapping("/authorize/{role}") - fun uriAuthorize(@PathVariable role: String, uri: String): HttpMessage { + @GetMapping("/authorize") + fun uriAuthorize(uri: String): HttpMessage { + val session = this.session() + val rid = session?.user()?.rid ?: "" return this.safeExecute("获取权限信息失败") { msg -> - msg.data = this.pageQuery.uriAuthorize(uri, role) + msg.data = this.pageQuery.uriAuthorize(uri, rid) } } - - } \ No newline at end of file diff --git a/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/resource/SystemApp.kt b/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/resource/SystemApp.kt index 16bf7ed..0c035fe 100644 --- a/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/resource/SystemApp.kt +++ b/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/resource/SystemApp.kt @@ -7,6 +7,7 @@ import com.synebula.gaea.spring.aop.annotation.Method import com.synebula.zeus.domain.service.cmd.rbac.resource.SystemCmd import com.synebula.zeus.domain.service.contr.rbac.resource.ISystemService import com.synebula.zeus.query.contr.resouce.ISystemQuery +import com.synebula.zeus.query.view.SignUserView import com.synebula.zeus.query.view.resource.SystemView import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PathVariable @@ -31,10 +32,12 @@ class SystemApp( } @Method("验证角色系统权限") - @GetMapping("/{system}/authorize/{role}") - fun authorize(@PathVariable system: String, @PathVariable role: String): HttpMessage { + @GetMapping("/{system}/authorize") + fun authorize(@PathVariable system: String): HttpMessage { + val session = this.session() + val rid = session?.user()?.rid ?: "" return this.safeExecute("获取权限信息失败") { msg -> - msg.data = this.systemQuery.authorize(system, role) + msg.data = this.systemQuery.authorize(system, rid) } } } \ No newline at end of file diff --git a/src/zeus.app/src/main/resources/application.yml b/src/zeus.app/src/main/resources/application.yml index b0bbb5c..8cb162c 100644 --- a/src/zeus.app/src/main/resources/application.yml +++ b/src/zeus.app/src/main/resources/application.yml @@ -1,11 +1,14 @@ server: port: 80 - + error: + whitelabel: + enabled: false spring: application: name: gaea.app sign-in-url: /sign/in - allow-multi-sign: ${ALLOW_MULTI_SIGN:false} + allow-multi-sign: ${ALLOW_MULTI_SIGN:true} + token-salt: ${TOKEN_SALT:7d25b8e5} data: mongodb: uri: ${DB_URL:mongodb://root:LcY221815@127.0.0.1/zeus} diff --git a/src/zeus.domain/build.gradle b/src/zeus.domain/build.gradle index 7878df1..cbbddfc 100644 --- a/src/zeus.domain/build.gradle +++ b/src/zeus.domain/build.gradle @@ -1,16 +1,4 @@ dependencies { api project(":src:zeus.env") api "com.synebula:gaea:$gaea_version" -} - -publishing { - publications { - publish(MavenPublication) { - group 'com.synebula' - artifactId 'zeus.domain' - version "$version" - from components.java - } - } -} - +} \ No newline at end of file diff --git a/src/zeus.domain/src/main/kotlin/com/synebula/zeus/domain/service/impl/rbac/UserService.kt b/src/zeus.domain/src/main/kotlin/com/synebula/zeus/domain/service/impl/rbac/UserService.kt index e076e5a..50bfd3a 100644 --- a/src/zeus.domain/src/main/kotlin/com/synebula/zeus/domain/service/impl/rbac/UserService.kt +++ b/src/zeus.domain/src/main/kotlin/com/synebula/zeus/domain/service/impl/rbac/UserService.kt @@ -61,10 +61,10 @@ class UserService( user.avalible = true user.token = null this.repository.update(user) - DataMessage(Status.Success, "用户${user.name}激活成功") + DataMessage(Status.SUCCESS, "用户${user.name}激活成功") } else { logger.warn(this, "用户${user.name}激活失败, {key: ${key}, token: $token") - DataMessage(Status.Failure, "用户${user.name}激活失败, 请从系统发送的邮件链接激活用户") + DataMessage(Status.FAILURE, "用户${user.name}激活失败, 请从系统发送的邮件链接激活用户") } } } @@ -78,7 +78,7 @@ class UserService( DataMessage() } else { logger.warn(this, "用户修改${user.name}密码失败, 旧密码验证不通过") - DataMessage(Status.Failure, "用户修改密码失败, 旧密码验证不通过") + DataMessage(Status.FAILURE, "用户修改密码失败, 旧密码验证不通过") } } @@ -95,7 +95,7 @@ class UserService( this, "用户重置${user.name}密码失败, 系统密码修改令牌:${user.token}, {key: $key , token: $token" ) - DataMessage(Status.Failure, "用户重置密码失败, 如需重置密码请从系统发送的邮件链接中重置") + DataMessage(Status.FAILURE, "用户重置密码失败, 如需重置密码请从系统发送的邮件链接中重置") } } @@ -107,6 +107,6 @@ class UserService( userNotifier?.forgot(user.id!!, user.name, user.token!!) DataMessage() } else - DataMessage(Status.Failure, "用户还未激活, 请先激活用户") + DataMessage(Status.FAILURE, "用户还未激活, 请先激活用户") } } \ No newline at end of file diff --git a/src/zeus.env/build.gradle b/src/zeus.env/build.gradle index 95d531a..106efd7 100644 --- a/src/zeus.env/build.gradle +++ b/src/zeus.env/build.gradle @@ -1,15 +1,3 @@ dependencies { api "com.synebula:gaea:$gaea_version" -} - -publishing { - publications { - publish(MavenPublication) { - group 'com.synebula' - artifactId 'zeus.env' - version "$version" - from components.java - } - } -} - +} \ No newline at end of file diff --git a/src/zeus.query/build.gradle b/src/zeus.query/build.gradle index 3bd4a66..6592be8 100644 --- a/src/zeus.query/build.gradle +++ b/src/zeus.query/build.gradle @@ -1,16 +1,4 @@ dependencies { api project(":src:zeus.env") api "com.synebula:gaea.mongodb:$gaea_version" -} - -publishing { - publications { - publish(MavenPublication) { - group 'com.synebula' - artifactId 'zeus.query' - version "$version" - from components.java - } - } -} - +} \ No newline at end of file diff --git a/src/zeus.query/src/main/kotlin/com/synebula/zeus/query/impl/UserQuery.kt b/src/zeus.query/src/main/kotlin/com/synebula/zeus/query/impl/UserQuery.kt index 225a3a3..4cc1a9c 100644 --- a/src/zeus.query/src/main/kotlin/com/synebula/zeus/query/impl/UserQuery.kt +++ b/src/zeus.query/src/main/kotlin/com/synebula/zeus/query/impl/UserQuery.kt @@ -38,7 +38,7 @@ class UserQuery(template: MongoTemplate) : ) ) } else - DataMessage(Status.Failure, "用户名或密码错误") + DataMessage(Status.FAILURE, "用户名或密码错误") } diff --git a/src/zeus.repository/build.gradle b/src/zeus.repository/build.gradle index 87ae0c6..f0b205f 100644 --- a/src/zeus.repository/build.gradle +++ b/src/zeus.repository/build.gradle @@ -2,16 +2,4 @@ dependencies { api project(":src:zeus.env") api project(":src:zeus.domain") api "com.synebula:gaea.mongodb:$gaea_version" -} - -publishing { - publications { - publish(MavenPublication) { - group 'com.synebula' - artifactId 'zeus.repository' - version "$version" - from components.java - } - } -} - +} \ No newline at end of file