feat: 1.1.0

修改gaea包
    修改权限接口
    修复build.gradle打包问题
    修改状态名
This commit is contained in:
2024-12-14 12:50:00 +08:00
parent 25062a9135
commit 54e4c61c3f
14 changed files with 57 additions and 109 deletions

View File

@@ -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
}
}
}
}

View File

@@ -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" },
])

View File

@@ -19,15 +19,3 @@ dependencies {
api "com.synebula:gaea.mongodb:$gaea_version"
}
publishing {
publications {
publish(MavenPublication) {
group 'com.synebula'
artifactId 'zeus.app'
version "$version"
from components.java
}
}
}

View File

@@ -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 = "系统中已存在该用户"
}
}

View File

@@ -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 = "找不到该用户信息"
}
}

View File

@@ -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<SignUserView>()?.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<SignUserView>()?.rid ?: ""
return this.safeExecute("获取权限信息失败") { msg ->
msg.data = this.pageQuery.uriAuthorize(uri, role)
msg.data = this.pageQuery.uriAuthorize(uri, rid)
}
}
}

View File

@@ -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<SignUserView>()?.rid ?: ""
return this.safeExecute("获取权限信息失败") { msg ->
msg.data = this.systemQuery.authorize(system, role)
msg.data = this.systemQuery.authorize(system, rid)
}
}
}

View File

@@ -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}

View File

@@ -2,15 +2,3 @@ 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
}
}
}

View File

@@ -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, "用户还未激活, 请先激活用户")
}
}

View File

@@ -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
}
}
}

View File

@@ -2,15 +2,3 @@ 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
}
}
}

View File

@@ -38,7 +38,7 @@ class UserQuery(template: MongoTemplate) :
)
)
} else
DataMessage(Status.Failure, "用户名或密码错误")
DataMessage(Status.FAILURE, "用户名或密码错误")
}

View File

@@ -3,15 +3,3 @@ dependencies {
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
}
}
}