diff options
Diffstat (limited to 'app/controllers/api_account.go')
-rw-r--r-- | app/controllers/api_account.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/controllers/api_account.go b/app/controllers/api_account.go index 815daf4..cecd334 100644 --- a/app/controllers/api_account.go +++ b/app/controllers/api_account.go | |||
@@ -2,14 +2,12 @@ package controllers | |||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "context" | 4 | "context" |
5 | "fmt" | ||
6 | "net/http" | 5 | "net/http" |
7 | "time" | 6 | "time" |
8 | 7 | ||
9 | "code.crute.us/mcrute/cloud-identity-broker/app" | 8 | "code.crute.us/mcrute/cloud-identity-broker/app" |
10 | "code.crute.us/mcrute/cloud-identity-broker/app/middleware" | 9 | "code.crute.us/mcrute/cloud-identity-broker/app/middleware" |
11 | "code.crute.us/mcrute/cloud-identity-broker/app/models" | 10 | "code.crute.us/mcrute/cloud-identity-broker/app/models" |
12 | "code.crute.us/mcrute/cloud-identity-broker/cloud/aws" | ||
13 | 11 | ||
14 | glecho "code.crute.us/mcrute/golib/echo" | 12 | glecho "code.crute.us/mcrute/golib/echo" |
15 | "code.crute.us/mcrute/golib/echo/controller" | 13 | "code.crute.us/mcrute/golib/echo/controller" |
@@ -90,7 +88,7 @@ func (h *APIAccountHandler) HandleGet(c echo.Context) error { | |||
90 | // details about the account so they should only be visible to users who | 88 | // details about the account so they should only be visible to users who |
91 | // can administer the account. | 89 | // can administer the account. |
92 | if !a.CanBeModifiedBy(p) { | 90 | if !a.CanBeModifiedBy(p) { |
93 | a.VaultMaterial = "" | 91 | a.AdminVaultMaterial = "" |
94 | a.Users = nil | 92 | a.Users = nil |
95 | } | 93 | } |
96 | 94 | ||
@@ -136,7 +134,7 @@ func (h *APIAccountHandler) HandlePut(c echo.Context) error { | |||
136 | a.AccountNumber = in.AccountNumber | 134 | a.AccountNumber = in.AccountNumber |
137 | a.Name = in.Name | 135 | a.Name = in.Name |
138 | a.ConsoleSessionDuration = in.ConsoleSessionDuration | 136 | a.ConsoleSessionDuration = in.ConsoleSessionDuration |
139 | a.VaultMaterial = in.VaultMaterial | 137 | a.AdminVaultMaterial = in.AdminVaultMaterial |
140 | a.DefaultRegion = in.DefaultRegion | 138 | a.DefaultRegion = in.DefaultRegion |
141 | a.Users = in.Users | 139 | a.Users = in.Users |
142 | 140 | ||
@@ -181,12 +179,14 @@ func (h *APIAccountHandler) HandlePost(c echo.Context) error { | |||
181 | } | 179 | } |
182 | } | 180 | } |
183 | 181 | ||
182 | /* TODO: Validate that the vault material exists | ||
184 | if err := aws.ValidateVaultMaterial(in.VaultMaterial); err != nil { | 183 | if err := aws.ValidateVaultMaterial(in.VaultMaterial); err != nil { |
185 | return &echo.HTTPError{ | 184 | return &echo.HTTPError{ |
186 | Code: http.StatusBadRequest, | 185 | Code: http.StatusBadRequest, |
187 | Message: fmt.Sprintf("Unable to access Vault material: %s", err), | 186 | Message: fmt.Sprintf("Unable to access Vault material: %s", err), |
188 | } | 187 | } |
189 | } | 188 | } |
189 | */ | ||
190 | 190 | ||
191 | if err := h.Store.Put(context.Background(), &in); err != nil { | 191 | if err := h.Store.Put(context.Background(), &in); err != nil { |
192 | return echo.ErrInternalServerError | 192 | return echo.ErrInternalServerError |