增加uri权限认证
This commit is contained in:
@@ -43,4 +43,13 @@ class PageApp(
|
||||
msg.data = this.pageQuery.authentication(page, role)
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/authentication/{role}")
|
||||
fun pathAuthentication(@PathVariable role: String, uri: String): HttpMessage {
|
||||
return this.safeExecute("获取权限信息失败") { msg ->
|
||||
msg.data = this.pageQuery.uriAuthentication(uri, role)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -11,4 +11,6 @@ interface IPageQuery : IQuery {
|
||||
fun withPermission(role: String, system: String? ): List<PageView>
|
||||
|
||||
fun authentication(resource: String, role: String): PermissionType?
|
||||
|
||||
fun uriAuthentication(path: String, role: String): PermissionType?
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import com.synebula.zeus.query.contr.resouce.IPermissionQuery
|
||||
import com.synebula.zeus.query.contr.resouce.ISystemQuery
|
||||
import com.synebula.zeus.query.view.resource.PageView
|
||||
import org.springframework.data.mongodb.core.MongoTemplate
|
||||
import org.springframework.data.mongodb.core.query.Criteria
|
||||
import org.springframework.data.mongodb.core.query.Query
|
||||
|
||||
class PageQuery(template: MongoTemplate, var permissionQuery: IPermissionQuery, var systemQuery: ISystemQuery) :
|
||||
MongoQuery(template), IPageQuery {
|
||||
@@ -36,4 +38,9 @@ class PageQuery(template: MongoTemplate, var permissionQuery: IPermissionQuery,
|
||||
override fun authentication(resource: String, role: String): PermissionType? {
|
||||
return this.permissionQuery.authentication(ResourceType.Page, resource, role)
|
||||
}
|
||||
|
||||
override fun uriAuthentication(path: String, role: String): PermissionType? {
|
||||
val page = this.template.findOne(Query.query(Criteria.where("uri").`is`(path)), this.clazz) ?: return null
|
||||
return this.authentication(page.id!!, role)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user