Allow ACLs for methods/relations
This commit is contained in:
parent
8381b05da1
commit
44dfe34647
|
@ -165,7 +165,7 @@ ACL.checkPermission = function (principalType, principalId, model, property, acc
|
|||
modelClass.settings.acls.forEach(function(acl) {
|
||||
staticACLs.push({
|
||||
model: model,
|
||||
property: ACL.ALL,
|
||||
property: acl.property || ACL.ALL,
|
||||
principalType: acl.principalType,
|
||||
principalId: acl.principalId, // TODO: Should it be a name?
|
||||
accessType: acl.accessType,
|
||||
|
@ -173,7 +173,11 @@ ACL.checkPermission = function (principalType, principalId, model, property, acc
|
|||
});
|
||||
});
|
||||
}
|
||||
var prop = modelClass && modelClass.definition.properties[property];
|
||||
var prop = modelClass &&
|
||||
(modelClass.definition.properties[property] // regular property
|
||||
|| (modelClass._scopeMeta && modelClass._scopeMeta[property]) // relation/scope
|
||||
|| modelClass[property] // static method
|
||||
|| modelClass.prototype[property]); // prototype method
|
||||
if(prop && prop.acls) {
|
||||
prop.acls.forEach(function(acl) {
|
||||
staticACLs.push({
|
||||
|
|
Loading…
Reference in New Issue