-
Notifications
You must be signed in to change notification settings - Fork 48
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
feat!: ADR-014: Permissions improvements #886
Conversation
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
…adr-014-implementation � Conflicts: � x/subspaces/legacy/v2/store_test.go � x/subspaces/simulation/genesis.go � x/subspaces/simulation/operations_groups.go � x/subspaces/simulation/operations_permissions.go � x/subspaces/types/permissions.go � x/subspaces/types/permissions_test.go
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
…adr-014-implementation
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #886 +/- ##
==========================================
+ Coverage 82.73% 82.90% +0.17%
==========================================
Files 133 132 -1
Lines 11548 11693 +145
==========================================
+ Hits 9554 9694 +140
+ Misses 1634 1628 -6
- Partials 360 371 +11
Continue to review full report at Codecov.
|
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
…adr-014-permissions-improvements � Conflicts: � client/docs/swagger-ui/swagger.yaml � proto/desmos/subspaces/v2/genesis.proto � proto/desmos/subspaces/v2/models.proto � proto/desmos/subspaces/v2/msgs.proto � proto/desmos/subspaces/v2/query.proto � x/posts/keeper/msg_server.go � x/posts/keeper/msg_server_test.go � x/posts/keeper/subspaces_hooks.go � x/posts/simulation/operations_attachments.go � x/posts/simulation/operations_polls.go � x/posts/simulation/operations_posts.go � x/relationships/keeper/hooks.go � x/subspaces/client/cli/cli_test.go � x/subspaces/client/cli/tx.go � x/subspaces/keeper/alias_functions.go � x/subspaces/keeper/genesis.go � x/subspaces/keeper/genesis_test.go � x/subspaces/keeper/grpc_query.go � x/subspaces/keeper/grpc_query_test.go � x/subspaces/keeper/hooks.go � x/subspaces/keeper/invariants_test.go � x/subspaces/keeper/msg_server.go � x/subspaces/keeper/msg_server_test.go � x/subspaces/keeper/permissions.go � x/subspaces/keeper/permissions_test.go � x/subspaces/keeper/subspaces.go � x/subspaces/keeper/subspaces_test.go � x/subspaces/legacy/v2/keys.go � x/subspaces/legacy/v2/models.go � x/subspaces/legacy/v2/permissions.go � x/subspaces/legacy/v2/store.go � x/subspaces/legacy/v2/store_test.go � x/subspaces/legacy/v3/store.go � x/subspaces/legacy/v3/store_test.go � x/subspaces/module.go � x/subspaces/simulation/decoder_test.go � x/subspaces/simulation/genesis.go � x/subspaces/simulation/operations_groups.go � x/subspaces/simulation/operations_permissions.go � x/subspaces/simulation/operations_subspaces.go � x/subspaces/types/genesis.go � x/subspaces/types/genesis.pb.go � x/subspaces/types/genesis_test.go � x/subspaces/types/hooks.go � x/subspaces/types/keys.go � x/subspaces/types/models.go � x/subspaces/types/models.pb.go � x/subspaces/types/msgs.go � x/subspaces/types/msgs.pb.go � x/subspaces/types/permissions.go � x/subspaces/types/permissions_test.go � x/subspaces/types/query.pb.go � x/subspaces/types/query.pb.gw.go
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
…adr-014-permissions-improvements
…adr-014-permissions-improvements � Conflicts: � x/subspaces/types/genesis_test.go � x/subspaces/types/permissions.go � x/subspaces/types/permissions_test.go
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
x/subspaces/types/permissions.go
Outdated
|
||
// newPermission returns a new Permission containing the given value | ||
func newPermission(permissionName string) Permission { | ||
return strings.ToUpper(strings.ReplaceAll(permissionName, " ", "_")) |
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 think it is better to merge all space first to avoid the typo case like registering write content
then getting WRITE__CONTENT
permission.
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've now improved the function to also handle such cases. Thanks for spotting this! 🙏
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
Can we have a query to show the all registered permissions? I think it would be useful to check existing permissions. |
Unfortunately, as permissions are registered when the binary is executed, no. They are not stored inside the current context so that's not possible. We will however have all the details inside our docs |
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.
Ready to go from my side~
Description
This PR improves the permissions systems as described on ADR-014.
Closes: #855
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change