修改认证返回值;删除无用bean注册

This commit is contained in:
2020-11-02 23:52:37 +08:00
parent 27a070cb36
commit b9bb63ea21
9 changed files with 10 additions and 23 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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