mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 18:32:16 +08:00

* 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>
53 lines
1014 B
Go
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
|
|
}
|