-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Role based ACLs #5000
Role based ACLs #5000
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5000 +/- ##
==========================================
- Coverage 94.3% 94.28% -0.03%
==========================================
Files 121 121
Lines 8760 8763 +3
==========================================
+ Hits 8261 8262 +1
- Misses 499 501 +2
Continue to review full report at Codecov.
|
Your code is building the role names as we go on, and will use them in the next query by simply indicating I noticed that in the first iteration when the direct roles are fetched, Roles have to be Publicly Readable, otherwise, the query won't yield results. Expl:
In order for the user to inherit all of these roles: if R3's ACL is different, lets say Read/Write by R3 only, then on query number 3: This is what i got from your code, or did i miss something ? |
If my previous reasoning was correct,
|
This is true, and this makes sense. You have to be able to read the role in order to benefit from it’s features (this is the feature being built now) With the current implementation, role follow ACL’s like any other object, as well, we’re using ACL’s in order to discover which roles are applied to the user based on what is already discovered. Any other implementation in not following the ACL’s. The only difference with your implementation (besides the amount of code and custom logic), is that self referencing roles can’t be discovered (Role3 only readable by Role3). And to be honest I’m not sure if that’s a corner case that we wanted in the first place. |
You meant can be discovered. I am not completely disagreeing with you on this, its a fine and is the middle solution for now. In other words, if we have 2 roles: Admins and Staff. But from a general role reasoning, the lower level roles should loose their privileges before the higher level ones, not the other way around. It doesnt make sence in my openion to allow such condition to take place. Its just a mater of small technicality. If you feel that this is a good solution, i am all for it. At least it adds a bit of flexibility. |
Small disclaimer, just noticed that the solution i proposed before does not get around that problem also. This could still happen if we explicitly prevent admins from accessing their role. (such like when we set the read access to master key only) |
Ok let's backtrack a minute, If you wanted to disable a role right now, you'd delete it right? If you'd need to adjust the role hierarchy, you'd move the users from one role to the other that would be the base role, or you would readjust the linking between the roles.
They are not, they are recursively discovered. The first layer of roles is and should always be the roles where the users is directly assigned. The n up layers of roles are the roles that are referenced by the discovered roles in the previous steps.
Well that's true, but your role is disabled and doesn't exists anymore, as well as all its associated privileges. What you describe is not roles following ACL's. It's roles following a complex logic of inheritance where a container role can be deleted and it's children associations are still available. And given the complexity of the code involved in this logic I am totally against supporting it. |
That's true, and I was not going to suggest supporting such logic, let's keep it simple then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have now taken two quick passes. Has not sunk in yet. Will come back to it again. At the least, I should be able to generate some questions. It is not obvious to me yet what is changing here or why.
@@ -7,7 +7,7 @@ const Auth = require("../lib/Auth").Auth; | |||
const Config = require("../lib/Config"); | |||
|
|||
describe('Parse Role testing', () => { | |||
it('Do a bunch of basic role testing', done => { | |||
xit('Do a bunch of basic role testing', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
intentional?
@@ -231,27 +236,28 @@ Auth.prototype._getAllRolesNamesForRoleIds = function(roleIDs, names = [], queri | |||
|
|||
// all roles are accounted for, return the names |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this comment still correct....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took a look 3rd try. I re-read the comments to try and guess what issue this PR is trying to solve, and so far, I am still not sure. The operative change in src/Auth.js
is not clear to me what the purpose or intent is.
@acinader the goal is to make role discovery dépendant on ACL’s instead of being run with the masterKey. This way, this let users enable and disable roles by changing their visibility through ACLs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I think I get what's going on.
what's the plan with the tests? do you want to leave all the XIT's in?
I need to have a look, but I believe the xited tests are irrelevant to the current behavior |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Thanks for opening this pull request!
|
No description provided.