增加角色管理
This commit is contained in:
@@ -12,9 +12,12 @@ import com.synebula.gaea.mongo.repository.MongoRepository
|
||||
import com.synebula.gaea.mongo.repository.MongoRepositoryTyped
|
||||
import com.synebula.gaea.query.IQuery
|
||||
import com.synebula.gaea.query.IQueryTyped
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.data.mongodb.core.MongoTemplate
|
||||
import org.springframework.web.filter.CharacterEncodingFilter
|
||||
|
||||
|
||||
@Configuration
|
||||
open class ZeusBeans {
|
||||
@@ -45,5 +48,4 @@ open class ZeusBeans {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.synebula.zeus.app.controller.rbac
|
||||
|
||||
import com.synebula.gaea.app.UnionTypedApp
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.gaea.query.IQueryTyped
|
||||
import com.synebula.zeus.domain.service.cmd.rbac.RoleCmd
|
||||
import com.synebula.zeus.domain.service.contr.rbac.IRoleService
|
||||
import com.synebula.zeus.query.view.RoleView
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/roles")
|
||||
class RoleApp(
|
||||
service: IRoleService,
|
||||
query: IQueryTyped,
|
||||
logger: ILogger
|
||||
) : UnionTypedApp<RoleCmd, RoleView, String>(
|
||||
"用户信息", RoleView::class.java,
|
||||
service, query, logger
|
||||
)
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.synebula.zeus.app.controller
|
||||
package com.synebula.zeus.app.controller.rbac
|
||||
|
||||
import com.synebula.gaea.app.UnionTypedApp
|
||||
import com.synebula.gaea.app.component.HttpMessage
|
||||
@@ -10,18 +10,19 @@ import com.synebula.zeus.domain.service.contr.rbac.IUserService
|
||||
import com.synebula.zeus.query.view.UserView
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/users")
|
||||
class UserApp(
|
||||
service: IUserService,
|
||||
query: IQueryTyped,
|
||||
logger: ILogger
|
||||
service: IUserService,
|
||||
query: IQueryTyped,
|
||||
logger: ILogger
|
||||
) : UnionTypedApp<UserCmd, UserView, String>(
|
||||
"用户信息", UserView::class.java,
|
||||
service, query, logger
|
||||
"用户信息", UserView::class.java,
|
||||
service, query, logger
|
||||
) {
|
||||
@Autowired
|
||||
lateinit var userAdded: IUserAdded
|
||||
@@ -38,9 +39,10 @@ class UserApp(
|
||||
* @param key 用户ID
|
||||
*/
|
||||
@GetMapping("/{key}/active")
|
||||
fun active(key: String) {
|
||||
fun active(@PathVariable key: String): String {
|
||||
this.safeExecute("激活用户出现异常") {
|
||||
(this.service as IUserService).active(key)
|
||||
}
|
||||
return "<html><body><div style='text-align: center; padding: 100px;'><h2>激活成功!</h2></div></body></html>"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.synebula.zeus.domain.service.contr.rbac
|
||||
|
||||
import com.synebula.gaea.domain.service.IService
|
||||
|
||||
interface IRoleService : IService<String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.synebula.zeus.domain.service.impl.rbac
|
||||
|
||||
import com.synebula.gaea.data.IObjectConverter
|
||||
import com.synebula.gaea.domain.repository.IRepository
|
||||
import com.synebula.gaea.domain.service.Service
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.zeus.domain.model.rbac.Role
|
||||
import com.synebula.zeus.domain.service.contr.rbac.IRoleService
|
||||
|
||||
class RoleService(repository: IRepository<Role, String>, converter: IObjectConverter, logger: ILogger) :
|
||||
Service<Role, String>(Role::class.java, repository, converter, logger), IRoleService
|
||||
Reference in New Issue
Block a user