1
傢伙們對node_Acl有困難。如何定義node_acl公共可訪問的資源
我已經adedd。
acl.allow('guest',['/docs/'],['show']);
app.use(acl.middleware);
但它顯示我用戶沒有被授權。訪問
acl.addUserRoles('api_user', 'business',function(err) {
if(!err) {
log.debug("api_user with business role created");
}
});
acl.addUserRoles('helpdesk', 'helpdesk',function(err) {
if(!err) {
log.debug("helpdesk with helpdesk role created");
}
});
acl.userRoles('admin', function(err, roles) {
log.debug(roles);
});
acl.roleUsers('business', function(err, users){
log.debug(users);
});
acl.hasRole('admin', 'business', function(err, hasRole) {
log.debug("admin user hasRole business =>"+hasRole);
});
acl.allow('admin', ['/api/hellobill/v1/hello'], ['get'], function(err) {
console.log("EROOR"+err);
});
acl.allow([
{
roles: ['guest'],
allows: [
{ resources: '/docs/', permissions: 'get' }
],
}
]);
acl.allow('guest', '/docs/', ['get','put', 'delete']);
app.get('/docs/', acl.middleware(), function (req, res) {
console.log(req);
});
acl.allow('public', ['/', '/docs/', '/api-docs/'], 'view');
acl.whatResources('public',function(err,resources){
console.log(resources);
})
請你看看附加的代碼嗎? – danielad
感謝您的編輯;我永遠無法從我的iPhone上正確使用格式。 – Paul
順便說一句,使用招搖中間件? – danielad