// UserByUID satisfies AccountProvider.
func (m *MockProvider) UserByUID(uid uint32) (*accounts.User, error) {
	for _, u := range m.Usrs {
		if uid == u.UID {
			return u, m.Err
		}
	}
	return nil, accounts.UIDNotFound(uid)
}
Example #2
0
// UserByName satisfies AccountProvider.
func (s *cachingStore) UserByUID(uid uint32) (*accounts.User, error) {
	s.RLock()
	defer s.RUnlock()
	cu, ok := s.usersByUID[uid]
	if ok {
		return cu.user, nil
	}
	return nil, accounts.UIDNotFound(uid)
}