Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not respecting denied: true of IAccessInfo in AccessControl.grant #67

Closed
anodynos opened this issue Feb 26, 2019 · 5 comments
Closed

Not respecting denied: true of IAccessInfo in AccessControl.grant #67

anodynos opened this issue Feb 26, 2019 · 5 comments
Labels
invalid Irrelevant or not an actual issue.

Comments

@anodynos
Copy link

anodynos commented Feb 26, 2019

It seems that denied: true of IAccessInfo in AccessControl.grant() is not respected - one has to explicitlly use .deny isntead of .grant to make it work:

import { AccessControl, IAccessInfo, IQueryInfo } from 'accesscontrol';

const ai: IAccessInfo = {
  role: 'QA_MANAGER',
  action: 'create:any',
  resource: 'document',
  denied: true, // <--- NOT RESPECTED
};

const ac1 = new AccessControl();
ac1.grant(ai);

const qi: IQueryInfo = {
  role: 'QA_MANAGER',
  action: 'create:any',
  resource: 'document',
};
const perm1 = ac1.permission(qi);
console.log(perm1.granted); // returns true, but should be false cause of `denied: true`

const ac2 = new AccessControl();
ac2.deny(ai);
const perm2 = ac2.permission(qi);
console.log(perm2.granted); // returns false, as expected

EDIT: solved in https://github.com/anodynos/accesscontrol-re

anodynos added a commit to anodynos/accesscontrol-re that referenced this issue Feb 26, 2019
@onury onury added the invalid Irrelevant or not an actual issue. label Feb 27, 2019
@onury
Copy link
Owner

onury commented Feb 27, 2019

No it's marked @private, and also not documented.
It's just an internal flag, not to be used by the end-user.

To deny; simply don't grant or explicitly deny().

@onury onury closed this as completed Feb 27, 2019
@onury
Copy link
Owner

onury commented Feb 27, 2019

..and it seems you copied the lib without forking. then fixing some bug on your repo and not committing back to the project but opening an issue here to let people know about your copy..

nice.

@anodynos
Copy link
Author

Thanks @onury - I didn't copy or fork the library, it's just a facade around your great library, with some urgently needed features & fixes that I needed. That's why there's no merging back to the project, which I hope will evolve and improve :-)

@onury
Copy link
Owner

onury commented Feb 27, 2019

fair enough. thanks. most needed features will be implemented soon.

@anodynos
Copy link
Author

Sounds great 👍 and thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Irrelevant or not an actual issue.
Projects
None yet
Development

No branches or pull requests

2 participants