ClientRights returns the rights the caller has on the given client.
(ctx context.Context, cliIDs *ttnpb.ClientIdentifiers)
| 121 | |
| 122 | // ClientRights returns the rights the caller has on the given client. |
| 123 | func (is *IdentityServer) ClientRights(ctx context.Context, cliIDs *ttnpb.ClientIdentifiers) (*ttnpb.Rights, error) { |
| 124 | entity, universal, err := is.getRights(ctx, cliIDs.GetEntityIdentifiers()) |
| 125 | if err != nil { |
| 126 | return nil, err |
| 127 | } |
| 128 | err = is.store.Transact(ctx, func(ctx context.Context, st store.Store) error { |
| 129 | _, err := st.GetClient(ctx, cliIDs, []string{"ids"}) |
| 130 | return err |
| 131 | }) |
| 132 | if errors.IsNotFound(err) { |
| 133 | if is.IsAdmin(ctx) { |
| 134 | return nil, err |
| 135 | } |
| 136 | return &ttnpb.Rights{}, nil |
| 137 | } else if err != nil { |
| 138 | return nil, err |
| 139 | } |
| 140 | return entity.Union(universal), nil |
| 141 | } |
| 142 | |
| 143 | // GatewayRights returns the rights the caller has on the given gateway. |
| 144 | // The query for the gateway only considers the Gateway ID and not the EUI (if provided). |
nothing calls this directly
no test coverage detected