更新GAEA到版本1.4.0
This commit is contained in:
@@ -14,15 +14,13 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
subprojects {
|
||||
group 'com.synebula'
|
||||
version version
|
||||
}
|
||||
|
||||
subprojects {
|
||||
ext {
|
||||
version '0.9.0'
|
||||
gaea_version = '1.2.0'
|
||||
gaea_version = '1.4.0'
|
||||
spring_version = "2.7.0"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.synebula.zeus.app.config
|
||||
|
||||
import com.synebula.gaea.app.autoconfig.service.ServiceScan
|
||||
import com.synebula.gaea.mongodb.autoconfig.MongodbRepoScan
|
||||
import com.synebula.gaea.mongodb.autoconfig.MongodbRepositoryScan
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
@Component
|
||||
@ServiceScan(basePackages = ["com.synebula.zeus.domain.service"])
|
||||
@MongodbRepoScan(basePackages = ["com.synebula.zeus.domain.repository", "com.synebula.zeus.repository", "com.synebula.zeus.query"])
|
||||
@MongodbRepositoryScan(basePackages = ["com.synebula.zeus.domain.repository", "com.synebula.zeus.repository", "com.synebula.zeus.query"])
|
||||
class ZeusServices
|
||||
@@ -2,7 +2,7 @@ package com.synebula.zeus.app.controller
|
||||
|
||||
import com.synebula.gaea.app.IApplication
|
||||
import com.synebula.gaea.app.component.security.TokenManager
|
||||
import com.synebula.gaea.app.struct.HttpMessage
|
||||
import com.synebula.gaea.data.message.HttpMessage
|
||||
import com.synebula.gaea.data.message.Status
|
||||
import com.synebula.gaea.data.serialization.json.IJsonSerializer
|
||||
import com.synebula.gaea.log.ILogger
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.synebula.zeus.app.controller.rbac
|
||||
|
||||
import com.synebula.gaea.app.Application
|
||||
import com.synebula.gaea.app.struct.HttpMessage
|
||||
import com.synebula.gaea.data.message.HttpMessage
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.gaea.spring.aop.annotation.Method
|
||||
import com.synebula.zeus.domain.service.cmd.rbac.AuthorityBatchAddCmd
|
||||
|
||||
@@ -16,5 +16,5 @@ class GroupApp(
|
||||
factory: IQueryFactory,
|
||||
logger: ILogger
|
||||
) : Application<GroupCmd, GroupView, String>(
|
||||
"分组信息", service, factory.createQuery(GroupView::class.java), logger
|
||||
"用户组信息", service, factory.createQuery(GroupView::class.java), logger
|
||||
)
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.synebula.zeus.app.controller.rbac
|
||||
|
||||
import com.synebula.gaea.app.Application
|
||||
import com.synebula.gaea.app.struct.HttpMessage
|
||||
import com.synebula.gaea.data.message.HttpMessage
|
||||
import com.synebula.gaea.data.message.Status
|
||||
import com.synebula.gaea.data.serialization.json.IJsonSerializer
|
||||
import com.synebula.gaea.log.ILogger
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.synebula.zeus.app.controller.rbac.resource
|
||||
|
||||
import com.synebula.gaea.app.Application
|
||||
import com.synebula.gaea.app.struct.HttpMessage
|
||||
import com.synebula.gaea.data.message.HttpMessage
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.gaea.spring.aop.annotation.Method
|
||||
import com.synebula.zeus.domain.service.cmd.rbac.resource.InterfaceCmd
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.synebula.zeus.app.controller.rbac.resource
|
||||
|
||||
import com.synebula.gaea.app.Application
|
||||
import com.synebula.gaea.app.struct.HttpMessage
|
||||
import com.synebula.gaea.data.message.HttpMessage
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.gaea.spring.aop.annotation.Method
|
||||
import com.synebula.gaea.spring.aop.annotation.Module
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.synebula.zeus.app.controller.rbac.resource
|
||||
|
||||
import com.synebula.gaea.app.Application
|
||||
import com.synebula.gaea.app.struct.HttpMessage
|
||||
import com.synebula.gaea.data.message.HttpMessage
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.gaea.spring.aop.annotation.Method
|
||||
import com.synebula.zeus.domain.service.cmd.rbac.resource.SystemCmd
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
package com.synebula.zeus.domain.service.impl.rbac
|
||||
|
||||
import com.synebula.gaea.bus.Subscribe
|
||||
import com.synebula.gaea.data.message.DataMessage
|
||||
import com.synebula.gaea.data.message.Status
|
||||
import com.synebula.gaea.data.serialization.IObjectMapper
|
||||
import com.synebula.gaea.domain.event.BeforeRemoveEvent
|
||||
import com.synebula.gaea.domain.repository.IRepositoryFactory
|
||||
import com.synebula.gaea.domain.service.ICommand
|
||||
import com.synebula.gaea.domain.service.Service
|
||||
import com.synebula.gaea.exception.NoticeUserException
|
||||
import com.synebula.gaea.ext.toMd5
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.zeus.domain.model.rbac.Group
|
||||
import com.synebula.zeus.domain.model.rbac.Role
|
||||
import com.synebula.zeus.domain.model.rbac.User
|
||||
import com.synebula.zeus.domain.service.component.IUserNotifier
|
||||
import com.synebula.zeus.domain.service.contr.rbac.IUserService
|
||||
@@ -20,24 +25,17 @@ class UserService(
|
||||
var logger: ILogger
|
||||
) : Service<User, String>(User::class.java, factory.createRepository(User::class.java), mapper), IUserService {
|
||||
|
||||
// init {
|
||||
// groupService.addBeforeRemoveListener(this.clazz.name) { id ->
|
||||
// val msg = Message()
|
||||
// if (this.repository.count(mapOf(Pair("group", id)), this.clazz) > 0) {
|
||||
// msg.status = Status.Failure
|
||||
// msg.message = "组下还有用户"
|
||||
// }
|
||||
// msg
|
||||
// }
|
||||
// roleService.addBeforeRemoveListener(this.clazz.name) { id ->
|
||||
// val msg = Message()
|
||||
// if (this.repository.count(mapOf(Pair("role", id)), this.clazz) > 0) {
|
||||
// msg.status = Status.Failure
|
||||
// msg.message = "角色下还有用户"
|
||||
// }
|
||||
// msg
|
||||
// }
|
||||
// }
|
||||
@Subscribe(["groupBeforeRemoveEvent"])
|
||||
fun beforeRoleRemove(event: BeforeRemoveEvent<Role, String>) {
|
||||
if (this.repository.count(mapOf(Pair("role", event.id!!))) > 0)
|
||||
throw NoticeUserException("角色下还有用户")
|
||||
}
|
||||
|
||||
@Subscribe(["groupBeforeRemoveEvent"])
|
||||
fun beforeGroupRemove(event: BeforeRemoveEvent<Group, String>) {
|
||||
if (this.repository.count(mapOf(Pair("group", event.id!!))) > 0)
|
||||
throw NoticeUserException("用户组下还有用户")
|
||||
}
|
||||
|
||||
override fun add(command: ICommand): DataMessage<String> {
|
||||
val user = this.map(command)
|
||||
@@ -65,7 +63,7 @@ class UserService(
|
||||
this.repository.update(user)
|
||||
DataMessage(Status.Success, "用户${user.name}激活成功")
|
||||
} else {
|
||||
logger.warn(this, "用户${user.name}激活失败, {key: ${key}, token: ${token}")
|
||||
logger.warn(this, "用户${user.name}激活失败, {key: ${key}, token: $token")
|
||||
DataMessage(Status.Failure, "用户${user.name}激活失败, 请从系统发送的邮件链接激活用户")
|
||||
}
|
||||
}
|
||||
@@ -93,7 +91,10 @@ class UserService(
|
||||
this.repository.update(user)
|
||||
DataMessage()
|
||||
} else {
|
||||
logger.warn(this, "用户重置${user.name}密码失败, 系统密码修改令牌:${user.token}, {key: ${key} , token: ${token}")
|
||||
logger.warn(
|
||||
this,
|
||||
"用户重置${user.name}密码失败, 系统密码修改令牌:${user.token}, {key: $key , token: $token"
|
||||
)
|
||||
DataMessage(Status.Failure, "用户重置密码失败, 如需重置密码请从系统发送的邮件链接中重置")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class InterfaceQuery(
|
||||
if (authority == AuthorityType.Deny)
|
||||
return listOf()
|
||||
}
|
||||
val params = mutableMapOf<String, Any>()
|
||||
val params = mutableMapOf<String, String>()
|
||||
if (system != null) params["system"] = system
|
||||
val interfaces = this.list(params)
|
||||
val authorities = this.authorityQuery.authorized(ResourceType.Interface, role)
|
||||
|
||||
@@ -24,7 +24,7 @@ class PageQuery(template: MongoTemplate, var authorityQuery: IAuthorityQuery, va
|
||||
if (authority == AuthorityType.Deny)
|
||||
return listOf()
|
||||
}
|
||||
val params = mutableMapOf<String, Any>()
|
||||
val params = mutableMapOf<String, String>()
|
||||
if (system != null) params["system"] = system
|
||||
val pages = this.list(params)
|
||||
val authorities = this.authorityQuery.authorized(ResourceType.Page, role)
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.synebula.gaea.query.Where
|
||||
class GroupView {
|
||||
var id: String? = null
|
||||
|
||||
@Where(Operator.like)
|
||||
@Where(Operator.Like)
|
||||
var name = ""
|
||||
|
||||
var desc = ""
|
||||
|
||||
@@ -12,7 +12,7 @@ class UserView {
|
||||
|
||||
var password: String = ""
|
||||
|
||||
@Where(Operator.like)
|
||||
@Where(Operator.Like)
|
||||
var realName: String? = null
|
||||
|
||||
var phone: String? = null
|
||||
|
||||
Reference in New Issue
Block a user