Skip to content

Commit 6c2097c

Browse files
committed
add UpdateAccountIsDirty method to cliStoreAdapter and dbStoreWrapper
1 parent 685b050 commit 6c2097c

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

cmd/keymaster/adapters_cli.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ func (c *cliStoreAdapter) AssignKeyToAccount(keyID, accountID int) error {
5858
}
5959
return km.AssignKeyToAccount(keyID, accountID)
6060
}
61+
func (c *cliStoreAdapter) UpdateAccountIsDirty(id int, dirty bool) error {
62+
return db.UpdateAccountIsDirty(id, dirty)
63+
}
6164
func (c *cliStoreAdapter) CreateSystemKey(publicKey, privateKey string) (int, error) {
6265
return db.CreateSystemKey(publicKey, privateKey)
6366
}
@@ -193,8 +196,17 @@ func (w *dbStoreWrapper) GetAccount(id int) (*model.Account, error) {
193196
func (w *dbStoreWrapper) AddAccount(username, hostname, label, tags string) (int, error) {
194197
return w.inner.AddAccount(username, hostname, label, tags)
195198
}
196-
func (w *dbStoreWrapper) DeleteAccount(accountID int) error { return w.inner.DeleteAccount(accountID) }
197-
func (w *dbStoreWrapper) AssignKeyToAccount(keyID, accountID int) error { return nil }
199+
func (w *dbStoreWrapper) DeleteAccount(accountID int) error { return w.inner.DeleteAccount(accountID) }
200+
func (w *dbStoreWrapper) AssignKeyToAccount(keyID, accountID int) error {
201+
km := db.DefaultKeyManager()
202+
if km == nil {
203+
return fmt.Errorf("no key manager available")
204+
}
205+
return km.AssignKeyToAccount(keyID, accountID)
206+
}
207+
func (w *dbStoreWrapper) UpdateAccountIsDirty(id int, dirty bool) error {
208+
return w.inner.UpdateAccountIsDirty(id, dirty)
209+
}
198210
func (w *dbStoreWrapper) CreateSystemKey(publicKey, privateKey string) (int, error) {
199211
return w.inner.CreateSystemKey(publicKey, privateKey)
200212
}

0 commit comments

Comments
 (0)