diff --git a/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/resource/PageApp.kt b/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/resource/PageApp.kt index 68f3d56..3782554 100644 --- a/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/resource/PageApp.kt +++ b/src/zeus.app/src/main/kotlin/com/synebula/zeus/app/controller/rbac/resource/PageApp.kt @@ -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) + } + } + + } \ No newline at end of file diff --git a/src/zeus.query/src/main/kotlin/com/synebula/zeus/query/contr/resouce/IPageQuery.kt b/src/zeus.query/src/main/kotlin/com/synebula/zeus/query/contr/resouce/IPageQuery.kt index 2ea2fd9..9681ebf 100644 --- a/src/zeus.query/src/main/kotlin/com/synebula/zeus/query/contr/resouce/IPageQuery.kt +++ b/src/zeus.query/src/main/kotlin/com/synebula/zeus/query/contr/resouce/IPageQuery.kt @@ -11,4 +11,6 @@ interface IPageQuery : IQuery { fun withPermission(role: String, system: String? ): List fun authentication(resource: String, role: String): PermissionType? + + fun uriAuthentication(path: String, role: String): PermissionType? } \ No newline at end of file diff --git a/src/zeus.query/src/main/kotlin/com/synebula/zeus/query/impl/resouce/PageQuery.kt b/src/zeus.query/src/main/kotlin/com/synebula/zeus/query/impl/resouce/PageQuery.kt index fafd785..190f8e2 100644 --- a/src/zeus.query/src/main/kotlin/com/synebula/zeus/query/impl/resouce/PageQuery.kt +++ b/src/zeus.query/src/main/kotlin/com/synebula/zeus/query/impl/resouce/PageQuery.kt @@ -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) + } } \ No newline at end of file