Skip to content

Ability to define a bulk ALLOW once a wildcard DENY is in place. #148

Closed

Description

@arlaneenalra

The way permissions are presently defined, a wildcard DENY trumps any acl does not exactly match on model, property, and accessType. While this is the technically correct solution, it would be nice to be able to setup a wildcard DENY for $everyone and then do a wildcard ALLOW for other roles.

I know this presents a problem with deciding which acl should have priority as there is currently nothing to assign a weight to roles or the acls themselves. Adding that should make this pretty simple to do.

Activity

  1. ritch commented on Jan 20, 2014

    @ritch
    Member

    This is tricky. I think everyone would agree that we need to err on the side of:

    Ooops I accidentally denied that request

    instead of

    Uh oh... I accidentally allowed that request!

    What would really help us define this solution is an example library / framework / platform that has this feature.

    I think you are on the right track with weighting. Currently the order ACLs are defined do not matter.

    I'm leaning towards a simpler approach: for more dynamic access control, you get a really handy hook so that you can ALLOW or DENY with javascript logic. Off the top of my head it would look like this:

    Product.on('access', function(ctx) {
      switch(ctx.type) {
        case 'read':
          ctx.allow();
        break;
        case 'write':
        case 'delete':
          if(ctx.is('admin', 'owner')) {
            ctx.allow();
          } else {
            ctx.deny();
          }
        break;
        default:
          ctx.deny('you must be an admin or owner...');
        break;
      }
    });

    A global hook would make it easy to define logic across models:

    app.on('access', function(ctx) {
      // also support async
      setTimeout(function() {
        if(ctx.model === 'SomeModel') {
          ctx.allow();
        } else {
          ctx.deny();
        }
      });
    });

    /cc @raymondfeng @bajtos

  2. arlaneenalra commented on Jan 21, 2014

    @arlaneenalra
    Author

    Unfortunately, I don't have a good example ACL system ... hmm.

    Having per-model and global hooks (I'd be more likely to use the global ones for what I'm doing) seems like it could be used to build what I'm looking for, but I'd have to handle role/acl configuration/definition in a custom manner... (Do able, just seems a bit unnecessary.)

  3. added this to the milestone on Feb 28, 2014
  4. self-assigned this
    on Feb 28, 2014
  5. raymondfeng commented on Jul 23, 2014

    @raymondfeng
    Member

    In addition to the proposal to have method/model/global level hooks (+1), maybe we can set up the 'global' ACLs on base Model or PersistedModel?

  6. modified the milestone: #Rel lb 2.0.0 on Sep 30, 2014
  7. changed the title [-]Feature Request: Ability to define a bulk ALLOW once a wildcard DENY is in place.[/-] [+]Ability to define a bulk ALLOW once a wildcard DENY is in place.[/+] on Feb 4, 2016
  8. bajtos commented on Apr 7, 2016

    @bajtos
    Member

    As part of our issue triage process, I am closing items that have been inactive for an extended period of time. If anybody thinks the feature proposed here is still relevant and should be prioritised, then please leave a comment to let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions