Files
Eric Leijonmarck b43e9b50b4 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>
2022-04-14 23:06:08 +01:00

53 lines
1014 B
Go

package database
import (
"fmt"
"github.com/grafana/grafana/pkg/models"
)
type ErrSAInvalidName struct {
}
func (e *ErrSAInvalidName) Error() string {
return "service account name already in use"
}
func (e *ErrSAInvalidName) Unwrap() error {
return models.ErrUserAlreadyExists
}
type ErrMissingSAToken struct {
}
func (e *ErrMissingSAToken) Error() string {
return "service account token not found"
}
func (e *ErrMissingSAToken) Unwrap() error {
return models.ErrApiKeyNotFound
}
type ErrInvalidExpirationSAToken struct {
}
func (e *ErrInvalidExpirationSAToken) Error() string {
return "service account token not found"
}
func (e *ErrInvalidExpirationSAToken) Unwrap() error {
return models.ErrInvalidApiKeyExpiration
}
type ErrDuplicateSAToken struct {
name string
}
func (e *ErrDuplicateSAToken) Error() string {
return fmt.Sprintf("service account token %s already exists in the organization", e.name)
}
func (e *ErrDuplicateSAToken) Unwrap() error {
return models.ErrDuplicateApiKey
}