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) {
|
modelClass.settings.acls.forEach(function(acl) {
|
||||||
staticACLs.push({
|
staticACLs.push({
|
||||||
model: model,
|
model: model,
|
||||||
property: ACL.ALL,
|
property: acl.property || ACL.ALL,
|
||||||
principalType: acl.principalType,
|
principalType: acl.principalType,
|
||||||
principalId: acl.principalId, // TODO: Should it be a name?
|
principalId: acl.principalId, // TODO: Should it be a name?
|
||||||
accessType: acl.accessType,
|
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) {
|
if(prop && prop.acls) {
|
||||||
prop.acls.forEach(function(acl) {
|
prop.acls.forEach(function(acl) {
|
||||||
staticACLs.push({
|
staticACLs.push({
|
||||||
|
|
Loading…
Reference in New Issue