Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
/**
* Module dependencies
*/
var acl = require('acl');
// Using the memory backend
acl = new acl(new acl.memoryBackend());
/**
* Invoke Torrents Permissions
*/
exports.invokeRolesPolicies = function () {
acl.allow(
[
{
roles: ['admin', 'oper'],
allows: [
{resources: '/api/albums', permissions: '*'},
{resources: '/api/albums/torrent/:torrentId', permissions: '*'},
{resources: '/api/albums/:albumId', permissions: '*'},
{resources: '/api/albums/:albumId/insert/:torrentId', permissions: '*'},
{resources: '/api/albums/:albumId/remove/:torrentId', permissions: '*'},
{resources: '/api/albums/:albumId/set/recommendlevel/:rlevel', permissions: '*'},
'use strict';
/**
* Module dependencies
*/
var acl = require('acl');
// Using the memory backend
acl = new acl(new acl.memoryBackend());
/**
* Invoke Torrents Permissions
*/
exports.invokeRolesPolicies = function () {
acl.allow(
[
{
roles: ['admin'],
allows: [
{resources: '/api/backup', permissions: '*'},
{resources: '/api/backup/:filename', permissions: '*'}
]
}
]
);
'use strict';
/**
* Module dependencies
*/
var acl = require('acl');
// Using the memory backend
acl = new acl(new acl.memoryBackend());
/**
* Invoke Articles Permissions
*/
exports.invokeRolesPolicies = function () {
acl.allow([{
roles: ['oper', 'admin'],
allows: [
{resources: '/api/requests', permissions: '*'},
{resources: '/api/requests/:requestId', permissions: '*'},
{resources: '/api/requests/:requestId/accept/:torrentId', permissions: '*'},
{resources: '/api/reqComments/:requestId', permissions: '*'},
{resources: '/api/reqComments/:requestId/:commentId', permissions: '*'},
{resources: '/api/reqComments/:requestId/:commentId/:subCommentId', permissions: '*'}
]
'use strict';
/**
* Module dependencies
*/
var acl = require('acl');
// Using the memory backend
acl = new acl(new acl.memoryBackend());
/**
* Invoke Articles Permissions
*/
exports.invokeRolesPolicies = function () {
acl.allow([{
roles: ['oper', 'admin'],
allows: [
{resources: '/api/makers', permissions: '*'},
{resources: '/api/makers/create/:userId', permissions: '*'},
{resources: '/api/makers/:makerId', permissions: '*'},
{resources: '/api/makers/:makerId/rating', permissions: '*'},
{resources: '/api/makers/:makerId/addMember/:username', permissions: '*'},
{resources: '/api/makers/:makerId/removeMember/:username', permissions: '*'}
]
}, {
'use strict';
/**
* Module dependencies
*/
var acl = require('acl');
// Using the memory backend
acl = new acl(new acl.memoryBackend());
/**
* Invoke Invitations Permissions
*/
exports.invokeRolesPolicies = function () {
acl.allow(
[
{
roles: ['admin', 'oper', 'user'],
allows: [
{resources: '/api/messages', permissions: '*'},
{resources: '/api/messages/:messageId', permissions: '*'},
{resources: '/api/messages/countUnread', permissions: '*'}
]
},
{
getACLInstance = function(aclBackend) {
if (acl) {
return acl;
}
aclBackend = aclBackend || { type: 'memory' };
aclBackend = aclBackend.type === 'memory' ? new ACL.memoryBackend()
: aclBackend.type === 'redis' ? aclBackend = new ACL.redisBackend(aclBackend.options.client, aclBackend.options.prefix)
: aclBackend.type === 'mongodb' ? aclBackend = new ACL.mongodbBackend(aclBackend.options.client, aclBackend.options.prefix)
: new ACL.memoryBackend();
acl = new ACL(aclBackend);
var rules = nconf.get('Security:ACL:Rules');
var users = nconf.get('Security:Users');
acl.allow(rules);
users.forEach(function(user) {
acl.addUserRoles(user.name, user.role);
});
return acl;