MCPcopy Create free account
hub / github.com/actiontech/dtle / FindUserList

Method FindUserList

driver/common/store.go:449–467  ·  view source on GitHub ↗
(userKey string)

Source from the content-addressed store, hash-verified

447}
448
449func (sm *StoreManager) FindUserList(userKey string) ([]*User, error) {
450 userKey = fmt.Sprintf("%s/%s", "dtleUser", userKey)
451 storeUsers, err := sm.consulStore.List(userKey)
452 if nil != err && err != store.ErrKeyNotFound {
453 return nil, fmt.Errorf("get %v value from consul failed: %v", userKey, err)
454 }
455 userList := make([]*User, 0)
456 for _, storeUser := range storeUsers {
457 user := new(User)
458 err = json.Unmarshal(storeUser.Value, user)
459 if err != nil {
460 return nil, fmt.Errorf("get %v from consul, unmarshal err : %v", storeUser, err)
461 }
462 user.Password = "*"
463 userList = append(userList, user)
464 }
465
466 return userList, nil
467}
468
469func (sm *StoreManager) FindTenantList() (tenants []string, err error) {
470 tenantKey := "dtleUser"

Callers 2

DeleteRoleV2Function · 0.95
UserListV2Function · 0.95

Calls 1

UnmarshalMethod · 0.65

Tested by

no test coverage detected