How to use the acl.memoryBackend function in acl

To help you get started, we’ve selected a few acl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github taobataoma / meanTorrent / modules / albums / server / policies / albums.server.policy.js View on Github external
'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: '*'},
github taobataoma / meanTorrent / modules / backup / server / policies / backup.server.policy.js View on Github external
'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: '*'}
        ]
      }
    ]
  );
github taobataoma / meanTorrent / modules / requests / server / policies / requests.server.policy.js View on Github external
'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: '*'}
    ]
github taobataoma / meanTorrent / modules / about / server / policies / about.server.policy.js View on Github external
'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: '*'}
    ]
  }, {
github taobataoma / meanTorrent / modules / messages / server / policies / messages.server.policy.js View on Github external
'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: '*'}
        ]
      },
      {
github dominiklessel / node-restify-boilerplate / plugins / customACLPlugin.js View on Github external
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;

acl

An Access Control List module, based on Redis with Express middleware support

Unknown
Latest version published 7 years ago

Package Health Score

41 / 100
Full package analysis

Popular acl functions