mirror of
https://github.com/grafana/grafana.git
synced 2026-08-19 01:34:54 -05:00
Service Accounts: Polish service account detail page (#45846)
* ServiceAccounts: add teams to service account DTO * ServiceAccounts: Add team display to service accounts * ServiceAccounts: add AC metadata to detail route * ServiceAccounts: add role picker to detail page * ServiceAccounts: Add role to profile DTO * ServiceAccounts: remove wip mention of created by
This commit is contained in:
@@ -178,6 +178,18 @@ func (s *ServiceAccountsStoreImpl) RetrieveServiceAccount(ctx context.Context, o
|
||||
return nil, serviceaccounts.ErrServiceAccountNotFound
|
||||
}
|
||||
|
||||
// Get Teams of service account. Can be optimized by combining with the query above
|
||||
// in refactor
|
||||
getTeamQuery := models.GetTeamsByUserQuery{UserId: serviceAccountID, OrgId: orgID}
|
||||
if err := s.sqlStore.GetTeamsByUser(ctx, &getTeamQuery); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
teams := make([]string, len(getTeamQuery.Result))
|
||||
|
||||
for i := range getTeamQuery.Result {
|
||||
teams[i] = getTeamQuery.Result[i].Name
|
||||
}
|
||||
|
||||
saProfile := &serviceaccounts.ServiceAccountProfileDTO{
|
||||
Id: query.Result[0].UserId,
|
||||
Name: query.Result[0].Name,
|
||||
@@ -185,6 +197,8 @@ func (s *ServiceAccountsStoreImpl) RetrieveServiceAccount(ctx context.Context, o
|
||||
OrgId: query.Result[0].OrgId,
|
||||
UpdatedAt: query.Result[0].Updated,
|
||||
CreatedAt: query.Result[0].Created,
|
||||
Role: query.Result[0].Role,
|
||||
Teams: teams,
|
||||
}
|
||||
return saProfile, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user