Open
Conversation
Moved decision logic into an authorizer Split classes from the attribute file into their own files in the right projects Removed the test controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
With the addition of
IGranularPermissionwe paved the way for a more flexible permission system that package developers could use to store their package permissions in if they want to instead of creating their own CRUD mechanicsThis PR adds a generic policy with matching requirement and resource, plus an authorizer that can be replaced to use these
IGranularPermissionin a non granular way. The granularity (permission for a specific entity with a given key) is left out in this case as that logic is usually specific to the context of the permission.An attribute is also added to quickly make use of this system. See LINK HERE for a tutorial.
Testing
Unit tests have been added to cover a variety of permutations regarding the resource and the decision logic.
To manually test, one could setup a controller similar to the one supplied below. Then add/remove/alter Granular permissions on a usergroup and try to call the controller method with a user belonging to said group.
Example controller
Todo post merge