Service accounts: RBAC the service account UI (#47788)

* WIP

* fix: bug for saving name did not remove edit

* refactor: better error msg

* Display the column Roles even when user can't see the role picker

* Remove spaces when building the search query request

* Disable Edit button and fix token addition and deletion

* Fix the error message text

Co-authored-by: Vardan Torosyan <vardants@gmail.com>
This commit is contained in:
Eric Leijonmarck
2022-04-14 23:06:08 +01:00
committed by GitHub
co-authored by Vardan Torosyan
parent 2a178bd73c
commit b43e9b50b4
7 changed files with 48 additions and 22 deletions
@@ -17,14 +17,14 @@ func (e *ErrSAInvalidName) Unwrap() error {
return models.ErrUserAlreadyExists
}
type ErrMisingSAToken struct {
type ErrMissingSAToken struct {
}
func (e *ErrMisingSAToken) Error() string {
func (e *ErrMissingSAToken) Error() string {
return "service account token not found"
}
func (e *ErrMisingSAToken) Unwrap() error {
func (e *ErrMissingSAToken) Unwrap() error {
return models.ErrApiKeyNotFound
}
@@ -44,7 +44,7 @@ type ErrDuplicateSAToken struct {
}
func (e *ErrDuplicateSAToken) Error() string {
return fmt.Sprintf("service account token %s already exists", e.name)
return fmt.Sprintf("service account token %s already exists in the organization", e.name)
}
func (e *ErrDuplicateSAToken) Unwrap() error {
@@ -57,7 +57,7 @@ func (s *ServiceAccountsStoreImpl) DeleteServiceAccountToken(ctx context.Context
if err != nil {
return err
} else if n == 0 {
return &ErrMisingSAToken{}
return &ErrMissingSAToken{}
}
return nil
})