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

Feature: Add username and domain name variables to ListInvitations Return value #1987

Closed
ianmuchyri opened this issue Dec 13, 2023 · 2 comments · Fixed by #2168
Closed

Feature: Add username and domain name variables to ListInvitations Return value #1987

ianmuchyri opened this issue Dec 13, 2023 · 2 comments · Fixed by #2168
Assignees
Milestone

Comments

@ianmuchyri
Copy link
Contributor

ianmuchyri commented Dec 13, 2023

Is your feature request related to a problem? Please describe.

When I list Invitations, I get the user ID and domain ID, and It's currently not possible to view a user with their ID if a user is not a super admin. Thus when displaying on the UI we display ID's which is not pleasing

image

Describe the feature you are requesting, as well as the possible use case(s) for it.

Return the user name and domain name as part of the return value for listing invitations

Indicate the importance of this feature to you.

Must-have

Anything else?

No response

@dborovcanin
Copy link
Collaborator

We do not need only a username, we also need a domain name.

@ianmuchyri ianmuchyri changed the title Feature: Add user name variable as part of the ListInvitations Return value Feature: Add user name and domain name variables as part of the ListInvitations Return value Dec 13, 2023
@dborovcanin dborovcanin transferred this issue from absmach/magistrala-old Jan 10, 2024
@dborovcanin dborovcanin added this to the S2 milestone Apr 3, 2024
@dborovcanin dborovcanin reopened this Apr 3, 2024
@dborovcanin dborovcanin assigned WashingtonKK and unassigned JeffMboya Apr 9, 2024
@arvindh123
Copy link
Contributor

Something like at here https://github.com/arvindh123/magistrala/blob/edecffd3bf26015f02cce7593152c1c193e7f03a/users/service.go#L117-L136
will work

func (svc service) ViewClient(ctx context.Context, token, id string) (mgclients.Client, error) {
	tokenUserID, err := svc.Identify(ctx, token)
	if err != nil {
		return mgclients.Client{}, err
	}

	if tokenUserID != id {
		if err := svc.checkSuperAdmin(ctx, tokenUserID); err == nil {
			client, err := svc.clients.RetrieveByID(ctx, id)
			if err != nil {
				return mgclients.Client{}, errors.Wrap(svcerr.ErrViewEntity, err)
			}
			client.Credentials.Secret = ""
			return client, nil
		}
	}
	client, err := svc.clients.RetrieveBasicInfoByID(ctx, id)
	if err != nil {
		return mgclients.Client{}, errors.Wrap(svcerr.ErrViewEntity, err)
	}
	client.Credentials.Secret = ""
	return client, nil
}

@arvindh123 arvindh123 modified the milestones: S2, S3 Apr 26, 2024
@dborovcanin dborovcanin modified the milestones: S3, S4 Apr 30, 2024
@dborovcanin dborovcanin changed the title Feature: Add user name and domain name variables as part of the ListInvitations Return value Feature: Add username and domain name variables to ListInvitations Return value May 15, 2024
@dborovcanin dborovcanin modified the milestones: S4, S5 May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants