Пример #1
0
// GroupByGID satisfies AccountProvider.
func (m *MockProvider) GroupByGID(gid uint32) (*accounts.Group, error) {
	for _, g := range m.Grps {
		if gid == g.GID {
			return g, m.Err
		}
	}
	return nil, accounts.GIDNotFound(gid)
}
Пример #2
0
// GroupByGID satisfies AccountProvider.
func (s *cachingStore) GroupByGID(gid uint32) (*accounts.Group, error) {
	s.RLock()
	defer s.RUnlock()
	g, ok := s.groupsByGID[gid]
	if ok {
		return g, nil
	}
	return nil, accounts.GIDNotFound(gid)
}