修改认证返回值;删除无用bean注册
This commit is contained in:
@@ -30,19 +30,6 @@ open class ZeusBeans {
|
|||||||
@Bean
|
@Bean
|
||||||
open fun gson(): Gson = Gson()
|
open fun gson(): Gson = Gson()
|
||||||
|
|
||||||
@Bean
|
|
||||||
open fun userNotifier(): IUserNotifier {
|
|
||||||
return object : IUserNotifier {
|
|
||||||
override fun added(id: String, name: String, token: String) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun forgot(id: String, name: String, token: String) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
open fun serializer(gson: Gson): IJsonSerializer {
|
open fun serializer(gson: Gson): IJsonSerializer {
|
||||||
return object : IJsonSerializer {
|
return object : IJsonSerializer {
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ interface IInterfaceQuery : IQuery {
|
|||||||
|
|
||||||
fun withPermission(role: String, system: String?): List<InterfaceView>
|
fun withPermission(role: String, system: String?): List<InterfaceView>
|
||||||
|
|
||||||
fun authentication(resource: String, role: String): PermissionType
|
fun authentication(resource: String, role: String): PermissionType?
|
||||||
}
|
}
|
||||||
@@ -10,5 +10,5 @@ interface IPageQuery : IQuery {
|
|||||||
|
|
||||||
fun withPermission(role: String, system: String? ): List<PageView>
|
fun withPermission(role: String, system: String? ): List<PageView>
|
||||||
|
|
||||||
fun authentication(resource: String, role: String): PermissionType
|
fun authentication(resource: String, role: String): PermissionType?
|
||||||
}
|
}
|
||||||
@@ -9,5 +9,5 @@ interface IPermissionQuery : IQuery {
|
|||||||
|
|
||||||
fun resourcePermissions(resourceType: ResourceType, role: String): List<PermissionView>
|
fun resourcePermissions(resourceType: ResourceType, role: String): List<PermissionView>
|
||||||
|
|
||||||
fun authentication(resourceType: ResourceType, resource: String, role: String): PermissionType
|
fun authentication(resourceType: ResourceType, resource: String, role: String): PermissionType?
|
||||||
}
|
}
|
||||||
@@ -8,5 +8,5 @@ interface ISystemQuery : IQuery {
|
|||||||
|
|
||||||
fun withPermission(role: String): List<SystemView>
|
fun withPermission(role: String): List<SystemView>
|
||||||
|
|
||||||
fun authentication(resource: String, role: String): PermissionType
|
fun authentication(resource: String, role: String): PermissionType?
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ class InterfaceQuery(template: MongoTemplate, var permissionQuery: IPermissionQu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun authentication(resource: String, role: String): PermissionType {
|
override fun authentication(resource: String, role: String): PermissionType? {
|
||||||
return this.permissionQuery.authentication(ResourceType.Interface, resource, role)
|
return this.permissionQuery.authentication(ResourceType.Interface, resource, role)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ class PageQuery(template: MongoTemplate, var permissionQuery: IPermissionQuery,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun authentication(resource: String, role: String): PermissionType {
|
override fun authentication(resource: String, role: String): PermissionType? {
|
||||||
return this.permissionQuery.authentication(ResourceType.Page, resource, role)
|
return this.permissionQuery.authentication(ResourceType.Page, resource, role)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,13 +21,13 @@ class PermissionQuery(template: MongoTemplate) : MongoQuery(template), IPermissi
|
|||||||
), this.clazz, this.collection)
|
), this.clazz, this.collection)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun authentication(resourceType: ResourceType, resource: String, role: String): PermissionType {
|
override fun authentication(resourceType: ResourceType, resource: String, role: String): PermissionType? {
|
||||||
val permission = this.template.findOne(
|
val permission = this.template.findOne(
|
||||||
Query.query(
|
Query.query(
|
||||||
Criteria.where("resourceType").`is`(resourceType)
|
Criteria.where("type").`is`(resourceType)
|
||||||
.and("resource").`is`(resource)
|
.and("resource").`is`(resource)
|
||||||
.and("role").`is`(role)
|
.and("role").`is`(role)
|
||||||
), this.clazz, this.collection)
|
), this.clazz, this.collection)
|
||||||
return permission?.authorization ?: PermissionType.Allow
|
return permission?.authorization
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ class SystemQuery(template: MongoTemplate, var permissionQuery: PermissionQuery)
|
|||||||
return systems.filter { i -> permissions.find { p -> i.id == p.resource }?.authorization == PermissionType.Allow }
|
return systems.filter { i -> permissions.find { p -> i.id == p.resource }?.authorization == PermissionType.Allow }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun authentication(resource: String, role: String): PermissionType {
|
override fun authentication(resource: String, role: String): PermissionType? {
|
||||||
return this.permissionQuery.authentication(ResourceType.System, resource, role)
|
return this.permissionQuery.authentication(ResourceType.System, resource, role)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user