-
Notifications
You must be signed in to change notification settings - Fork 672
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
NOISSUE - Fix: Clients, Channels roles initialization and Channels connection Authz #2663
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright (c) Abstract Machines | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package channels | ||
|
||
import "github.com/absmach/supermq/pkg/roles" | ||
|
||
const BuiltInRoleAdmin roles.BuiltInRoleName = "admin" |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright (c) Abstract Machines | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package clients | ||
|
||
import "github.com/absmach/supermq/pkg/roles" | ||
|
||
const BuiltInRoleAdmin roles.BuiltInRoleName = "admin" |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
This signature looks messy. We have id provider twice, and we have way too many params. Can we group roles and actions (maybe something else as well) to a new config struct?
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.
This is still not addressed.
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.
Roles need short ID provider, but now we are using uuid for role , it is making the url path longer.
Already we are domain id and entity id in url.
Example requests:
For instance if Client id is
87714e08-3087-476e-8a12-c7bee595b31d
client role id isclient_4tuyg19Dwd6AzwmnbWr3v6Wm
and domain id is960c325a-c973-45f8-9c0b-f9f686941c7b
Get All actions of client
Method: GET URL:
http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/actions
Add All actions
Method: POST URL:
http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/actions
Delete actions
Method: POST URL:
http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/actions/delete
Delete all actions
Method: POST URL:
http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/actions/delete-all
Get All members
Method: GET URL:
http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/members
Add All members
Method: POST URL:
http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/members
Delete members
Method: POST URL:
http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/members
Delete all members
Method: POST URL:
http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/members/delete-all
Here Role ID : client_4tuyg19Dwd6AzwmnbWr3v6Wm is encoded using
https://github.com/sqids/sqids-go
The code is here https://github.com/absmach/supermq/blob/main/pkg/sid/sid.go
So something like this https://github.com/teris-io/shortid we need
Because of licenses i could decide which one to use
Related to
AvailableActions
andBuiltInRoles
could not be combined because they are using for different purpose.AvailableActions
is list of string which helps user to understand which actions can be added to role.BuiltInRole
contains map of built in role with respective actions , which will automatically added to entity during it creation process