0
我想了一個名爲profile
屬性添加到用戶模式:迴環ACL用戶的財產
var User = app.models.User;
User.profile = function(cb) {
cb(null, "TEST");
}
User.remoteMethod('profile', {
accepts: [
{arg: 'id', type: 'number', required: true}
],
returns: {arg: 'id', type: 'string'},
http: {path: '/:id/profile', verb: 'get'}
});
然後我說這個ACL:
var ACL = app.models.ACL;
ACL.create({
model: 'user',
accessType: 'EXECUTE',
principalType: 'ROLE',
principalId: '$owner',
permission: 'ALLOW',
property: 'profile'
}, function (err, acl) {
console.log('ACL entry created: %j', acl);
});
當我去這個網址:http://localhost:3000/api/users/2/profile
,它返回Error: Custom message: Authorization Required
。 access_token是正確的,因爲當我去http://localhost:3000/api/users/2/
它返回正確的數據。 我錯過了什麼?