mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fixed validation for adding api keys, added unique index for api key name + account_id
This commit is contained in:
parent
ed6d50d6ba
commit
23bbc5160e
@ -20,8 +20,8 @@ type ApiKey struct {
|
|||||||
// ---------------------
|
// ---------------------
|
||||||
// COMMANDS
|
// COMMANDS
|
||||||
type AddApiKeyCommand struct {
|
type AddApiKeyCommand struct {
|
||||||
Name string `json:"name" binding:"required"`
|
Name string `json:"name" binding:"Required"`
|
||||||
Role RoleType `json:"role" binding:"required"`
|
Role RoleType `json:"role" binding:"Required"`
|
||||||
AccountId int64 `json:"-"`
|
AccountId int64 `json:"-"`
|
||||||
Key string `json:"-"`
|
Key string `json:"-"`
|
||||||
|
|
||||||
|
@ -172,4 +172,7 @@ func addApiKeyMigrations(mg *Migrator) {
|
|||||||
|
|
||||||
mg.AddMigration("add index api_key.key", new(AddIndexMigration).
|
mg.AddMigration("add index api_key.key", new(AddIndexMigration).
|
||||||
Table("api_key").Columns("key").Unique())
|
Table("api_key").Columns("key").Unique())
|
||||||
|
|
||||||
|
mg.AddMigration("add index api_key.account_id_name", new(AddIndexMigration).
|
||||||
|
Table("api_key").Columns("account_id", "name").Unique())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user