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

SMQ 2667 - Add: List all the users who can access the entity #2673

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

arvindh123
Copy link
Contributor

@arvindh123 arvindh123 commented Jan 30, 2025

What type of PR is this?

This is a feature because it adds the following functionality:

  • List all the users who can access the entity

What does this do?

List all the users who can access the entity

Which issue(s) does this PR fix/relate to?

Have you included tests for your changes?

Did you document any new/modified feature?

Notes

Example Request :
Method: GET

  • http:///domains/<domain_id>/roles/members
  • http:///<domain_id>/groups/:groupID/roles/members
  • http:///<domain_id>/channels/:channelID/roles/members
  • http:///<domain_id>/clients/:clientID/roles/members

@arvindh123 arvindh123 requested a review from a team as a code owner January 30, 2025 13:55
Signed-off-by: Arvindh <[email protected]>
@arvindh123 arvindh123 force-pushed the remove_domain_user_2 branch from e5dfdc9 to c344ad5 Compare January 30, 2025 13:55
Signed-off-by: Arvindh <[email protected]>
Copy link

codecov bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 1.09489% with 271 lines in your changes missing coverage. Please review.

Project coverage is 38.69%. Comparing base (3cb41fa) to head (ca7af6e).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
pkg/sdk/mocks/sdk.go 0.00% 44 Missing ⚠️
channels/mocks/repository.go 0.00% 33 Missing ⚠️
channels/mocks/service.go 0.00% 33 Missing ⚠️
clients/mocks/repository.go 0.00% 33 Missing ⚠️
clients/mocks/service.go 0.00% 33 Missing ⚠️
groups/mocks/repository.go 0.00% 33 Missing ⚠️
groups/mocks/service.go 0.00% 33 Missing ⚠️
pkg/sdk/roles.go 0.00% 18 Missing ⚠️
pkg/sdk/channels.go 0.00% 2 Missing ⚠️
pkg/sdk/clients.go 0.00% 2 Missing ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2673      +/-   ##
==========================================
- Coverage   43.87%   38.69%   -5.19%     
==========================================
  Files         350      181     -169     
  Lines       45718    31735   -13983     
==========================================
- Hits        20059    12279    -7780     
+ Misses      23438    18500    -4938     
+ Partials     2221      956    -1265     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dborovcanin
Copy link
Collaborator

@ianmuchyri Please review and test.

Comment on lines 23 to 79
MemberKindKey = "member_kind"
PermissionKey = "permission"
RelationKey = "relation"
StatusKey = "status"
OffsetKey = "offset"
OrderKey = "order"
LimitKey = "limit"
MetadataKey = "metadata"
ParentKey = "parent_id"
OwnerKey = "owner_id"
ClientKey = "client"
UsernameKey = "username"
NameKey = "name"
GroupKey = "group"
ActionKey = "action"
ActionsKey = "actions"
RoleIDKey = "role_id"
RoleNameKey = "role_name"
AccessProviderIDKey = "access_provider_id"
AccessTypeKey = "access_type"
TagKey = "tag"
FirstNameKey = "first_name"
LastNameKey = "last_name"
TotalKey = "total"
SubjectKey = "subject"
ObjectKey = "object"
LevelKey = "level"
StartLevelKey = "start_level"
EndLevelKey = "end_level"
TreeKey = "tree"
DirKey = "dir"
ListPerms = "list_perms"
VisibilityKey = "visibility"
EmailKey = "email"
SharedByKey = "shared_by"
TokenKey = "token"
UserKey = "user"
DomainKey = "domain"
ChannelKey = "channel"
ConnTypeKey = "connection_type"
DefPermission = "read_permission"
DefTotal = uint64(100)
DefOffset = 0
DefOrder = "updated_at"
DefDir = "asc"
DefLimit = 10
DefLevel = 0
DefStartLevel = 1
DefEndLevel = 0
DefStatus = "enabled"
DefClientStatus = clients.Enabled
DefUserStatus = users.Enabled
DefGroupStatus = groups.Enabled
DefListPerms = false
SharedVisibility = "shared"
MyVisibility = "mine"
AllVisibility = "all"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we logically group these keys (per API?) so we split this large const block?

@@ -141,6 +141,9 @@ var (
// ErrInvalidComparator indicates an invalid comparator.
ErrInvalidComparator = errors.New("invalid comparator")

// ErrMissingMemberIDs indicates missing group member type.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix comment.

@@ -53,6 +53,52 @@ func (req listRolesReq) validate() error {
return nil
}

type listEntityMembersReq struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are members = users who can access it? If yes, please change to listEntityUsersReq and add a comment explaining that.

Comment on lines +30 to +35
r.Get("/members", otelhttp.NewHandler(kithttp.NewServer(
ListEntityMembersEndpoint(svc),
d.DecodeListEntityMembers,
api.EncodeResponse,
opts...,
), "list_entity_members").ServeHTTP)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, use Users instead of members, since we are not talking about groups here.

SammyOina
SammyOina previously approved these changes Jan 30, 2025
ianmuchyri
ianmuchyri previously approved these changes Jan 30, 2025
@arvindh123 arvindh123 force-pushed the remove_domain_user_2 branch 5 times, most recently from f53efcd to 491ba6e Compare January 31, 2025 14:08
@arvindh123 arvindh123 force-pushed the remove_domain_user_2 branch from 491ba6e to ca7af6e Compare January 31, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

List all the users who can access the entity (channels, clients, groups, domains)
4 participants