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

Method UserRights

pkg/auth/rights/cache.go:278–296  ·  view source on GitHub ↗
(ctx context.Context, userID *ttnpb.UserIdentifiers)

Source from the content-addressed store, hash-verified

276}
277
278func (f *inMemoryCache) UserRights(ctx context.Context, userID *ttnpb.UserIdentifiers) (rights *ttnpb.Rights, err error) {
279 defer func() { registerRightsRequest(ctx, "user", rights, err) }()
280 req := newEntityReq(ctx, userID.GetEntityIdentifiers())
281 f.mu.Lock()
282 res := f.userRights[req]
283 if !res.valid(f.successTTL, f.errorTTL) {
284 res = newRes()
285 f.userRights[req] = res
286 go func() {
287 res.set(f.Fetcher.UserRights(ctx, userID))
288 }()
289 }
290 f.maybeCleanup()
291 f.mu.Unlock()
292 if err := res.wait(ctx); err != nil {
293 return nil, err
294 }
295 return res.rights, res.err
296}

Callers

nothing calls this directly

Calls 9

maybeCleanupMethod · 0.95
registerRightsRequestFunction · 0.85
newEntityReqFunction · 0.85
newResFunction · 0.85
waitMethod · 0.80
GetEntityIdentifiersMethod · 0.65
UserRightsMethod · 0.65
validMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected