增加角色管理

This commit is contained in:
2020-05-22 10:18:37 +08:00
parent b2f6ba6b50
commit 2c1d607d62
5 changed files with 51 additions and 8 deletions

View File

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

View File

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

View File

@@ -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,6 +10,7 @@ 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
@@ -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>"
}
}

View File

@@ -0,0 +1,7 @@
package com.synebula.zeus.domain.service.contr.rbac
import com.synebula.gaea.domain.service.IService
interface IRoleService : IService<String> {
}

View File

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