Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Owner function called multiple times #12

Open
horvayev opened this issue Oct 6, 2020 · 0 comments
Open

Owner function called multiple times #12

horvayev opened this issue Oct 6, 2020 · 0 comments

Comments

@horvayev
Copy link

horvayev commented Oct 6, 2020

Is calling owner function for each match in grant intended feature or a bug? Example:

const axesor = require('axesor');

const grants = {
  admin: {
    video: {
      'read:own': ['*']
    }
  },
  reader: {
    video: {
      'read:own': ['*']
    }
  }
} 

const options = {
    getRoles: () => ['admin', 'reader'],
    ownerFunctions: {
      video: () => {
        console.log('video owner function')
      }
    }
};

const ac = new axesor.Acl(grants, options);

ac.can({}).read({ title: 'test' }, 'video');

video owner function is called twice in that case

https://repl.it/join/yvpignqp-jevhenijhorvat

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant