modify permission type, default means not config it, null means not exist
This commit is contained in:
@@ -21,7 +21,7 @@ allprojects {
|
|||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
ext {
|
ext {
|
||||||
version '0.5.1'
|
version '0.5.2'
|
||||||
gaea_version = '0.6.0'
|
gaea_version = '0.6.0'
|
||||||
spring_version = "2.3.0.RELEASE"
|
spring_version = "2.3.0.RELEASE"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.synebula.zeus.env
|
package com.synebula.zeus.env
|
||||||
|
|
||||||
enum class PermissionType {
|
enum class PermissionType {
|
||||||
|
Default,
|
||||||
Deny,
|
Deny,
|
||||||
Allow
|
Allow
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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("type").`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?.authority
|
return permission?.authority ?: PermissionType.Default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user