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

Method ApplicationRights

pkg/auth/rights/cache.go:198–216  ·  view source on GitHub ↗
(ctx context.Context, appID *ttnpb.ApplicationIdentifiers)

Source from the content-addressed store, hash-verified

196}
197
198func (f *inMemoryCache) ApplicationRights(ctx context.Context, appID *ttnpb.ApplicationIdentifiers) (rights *ttnpb.Rights, err error) {
199 defer func() { registerRightsRequest(ctx, "application", rights, err) }()
200 req := newEntityReq(ctx, appID.GetEntityIdentifiers())
201 f.mu.Lock()
202 res := f.applicationRights[req]
203 if !res.valid(f.successTTL, f.errorTTL) {
204 res = newRes()
205 f.applicationRights[req] = res
206 go func() {
207 res.set(f.Fetcher.ApplicationRights(ctx, appID))
208 }()
209 }
210 f.maybeCleanup()
211 f.mu.Unlock()
212 if err := res.wait(ctx); err != nil {
213 return nil, err
214 }
215 return res.rights, res.err
216}
217
218func (f *inMemoryCache) ClientRights(ctx context.Context, clientID *ttnpb.ClientIdentifiers) (rights *ttnpb.Rights, err error) {
219 defer func() { registerRightsRequest(ctx, "client", rights, err) }()

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
ApplicationRightsMethod · 0.65
validMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected