MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / fetchEntityRights

Function fetchEntityRights

pkg/auth/rights/fetcher_test.go:34–71  ·  view source on GitHub ↗
(ctx context.Context, id string, f rights.EntityFetcher)

Source from the content-addressed store, hash-verified

32)
33
34func fetchEntityRights(ctx context.Context, id string, f rights.EntityFetcher) (res struct { // nolint:unparam
35 AppRights *ttnpb.Rights
36 AppErr error
37 CliRights *ttnpb.Rights
38 CliErr error
39 GtwRights *ttnpb.Rights
40 GtwErr error
41 OrgRights *ttnpb.Rights
42 OrgErr error
43 UsrRights *ttnpb.Rights
44 UsrErr error
45},
46) {
47 var wg sync.WaitGroup
48 wg.Add(5)
49 go func() {
50 res.AppRights, res.AppErr = f.ApplicationRights(ctx, &ttnpb.ApplicationIdentifiers{ApplicationId: id})
51 wg.Done()
52 }()
53 go func() {
54 res.CliRights, res.CliErr = f.ClientRights(ctx, &ttnpb.ClientIdentifiers{ClientId: id})
55 wg.Done()
56 }()
57 go func() {
58 res.GtwRights, res.GtwErr = f.GatewayRights(ctx, &ttnpb.GatewayIdentifiers{GatewayId: id})
59 wg.Done()
60 }()
61 go func() {
62 res.OrgRights, res.OrgErr = f.OrganizationRights(ctx, &ttnpb.OrganizationIdentifiers{OrganizationId: id})
63 wg.Done()
64 }()
65 go func() {
66 res.UsrRights, res.UsrErr = f.UserRights(ctx, &ttnpb.UserIdentifiers{UserId: id})
67 wg.Done()
68 }()
69 wg.Wait()
70 return res
71}
72
73func fetchAuthInfo(ctx context.Context, f rights.AuthInfoFetcher) (*ttnpb.AuthInfoResponse, error) {
74 return f.AuthInfo(ctx)

Callers 3

TestEntityFetcherFuncFunction · 0.85
TestAccessFetcherFunction · 0.85
TestCacheFunction · 0.85

Calls 8

DoneMethod · 0.80
AddMethod · 0.65
ApplicationRightsMethod · 0.65
ClientRightsMethod · 0.65
GatewayRightsMethod · 0.65
OrganizationRightsMethod · 0.65
UserRightsMethod · 0.65
WaitMethod · 0.65

Tested by

no test coverage detected