Merge branch 'dev'
This commit is contained in:
@@ -21,8 +21,8 @@ allprojects {
|
||||
|
||||
subprojects {
|
||||
ext {
|
||||
version '0.5.0'
|
||||
gaea_version = '0.6.0'
|
||||
version '0.5.2'
|
||||
gaea_version = '0.6.1'
|
||||
spring_version = "2.3.0.RELEASE"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.synebula.zeus.env
|
||||
|
||||
enum class PermissionType {
|
||||
Default,
|
||||
Deny,
|
||||
Allow
|
||||
}
|
||||
@@ -9,5 +9,5 @@ interface IPermissionQuery : IQuery {
|
||||
|
||||
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
|
||||
}
|
||||
@@ -31,7 +31,7 @@ class PageQuery(template: MongoTemplate, var permissionQuery: IPermissionQuery,
|
||||
val permissions = this.permissionQuery.resourcePermissions(ResourceType.Page, role)
|
||||
return pages.filter { i ->
|
||||
val permission = permissions.find { p -> i.id == p.resource }
|
||||
permission == null || permission.authority == PermissionType.Allow
|
||||
permission != null && permission.authority == PermissionType.Allow
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@ class PermissionQuery(template: MongoTemplate) : MongoQuery(template), IPermissi
|
||||
), 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(
|
||||
Query.query(
|
||||
Criteria.where("type").`is`(resourceType)
|
||||
.and("resource").`is`(resource)
|
||||
.and("role").`is`(role)
|
||||
), this.clazz, this.collection)
|
||||
return permission?.authority
|
||||
return permission?.authority ?: PermissionType.Default
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user