Add Docker ID integration

This commit is contained in:
Jonathan Leibiusky @xetorthio
2017-10-10 15:27:38 -03:00
parent 978fd78127
commit e9dd97e4e4
11 changed files with 125 additions and 10 deletions

View File

@@ -353,6 +353,16 @@ func (store *storage) UserPut(user *types.User) error {
return nil
}
func (store *storage) UserGet(id string) (*types.User, error) {
store.rw.Lock()
defer store.rw.Unlock()
if user, found := store.db.Users[id]; !found {
return nil, NotFoundError
} else {
return user, nil
}
}
func (store *storage) load() error {
file, err := os.Open(store.path)

View File

@@ -102,3 +102,7 @@ func (m *Mock) UserPut(user *types.User) error {
args := m.Called(user)
return args.Error(0)
}
func (m *Mock) UserGet(id string) (*types.User, error) {
args := m.Called(id)
return args.Get(0).(*types.User), args.Error(1)
}

View File

@@ -41,4 +41,5 @@ type StorageApi interface {
UserFindByProvider(providerName, providerUserId string) (*types.User, error)
UserPut(user *types.User) error
UserGet(id string) (*types.User, error)
}