TheThingsNetwork / lorawan-stack

The Things Stack, an Open Source LoRaWAN Network Server
https://www.thethingsindustries.com/stack/
Apache License 2.0
980 stars 309 forks source link

Improve application rights handling in the Console #5083

Closed bafonins closed 2 years ago

bafonins commented 2 years ago

Summary

If you add application collaborator without RIGHT_APPLICATION_TRAFFIC_READ, login as collaborator user and request rights for this application RIGHT_APPLICATION_TRAFFIC_READ is present.

Payloads request when adding collaborator ``` // note: No `RIGHT_APPLICATION_TRAFFIC_READ` right { "collaborator": { "ids": { "user_ids": { "user_id": "test-user" } }, "rights": [ "RIGHT_APPLICATION_DELETE", "RIGHT_APPLICATION_DEVICES_READ_KEYS", "RIGHT_APPLICATION_DEVICES_READ", "RIGHT_APPLICATION_DEVICES_WRITE_KEYS", "RIGHT_APPLICATION_DEVICES_WRITE", "RIGHT_APPLICATION_INFO", "RIGHT_APPLICATION_LINK", "RIGHT_APPLICATION_SETTINGS_API_KEYS", "RIGHT_APPLICATION_SETTINGS_BASIC", "RIGHT_APPLICATION_SETTINGS_COLLABORATORS", "RIGHT_APPLICATION_SETTINGS_PACKAGES", "RIGHT_APPLICATION_TRAFFIC_DOWN_WRITE", "RIGHT_APPLICATION_TRAFFIC_UP_WRITE" ] } } ``` response when fetching collaborator rights ``` // note: `RIGHT_APPLICATION_TRAFFIC_READ` is present. { "rights": [ "RIGHT_APPLICATION_DELETE", "RIGHT_APPLICATION_DEVICES_READ_KEYS", "RIGHT_APPLICATION_DEVICES_READ" "RIGHT_APPLICATION_DEVICES_WRITE_KEYS", "RIGHT_APPLICATION_DEVICES_WRITE", "RIGHT_APPLICATION_INFO", "RIGHT_APPLICATION_LINK", "RIGHT_APPLICATION_SETTINGS_API_KEYS", "RIGHT_APPLICATION_SETTINGS_BASIC", "RIGHT_APPLICATION_SETTINGS_COLLABORATORS", "RIGHT_APPLICATION_SETTINGS_PACKAGES", "RIGHT_APPLICATION_TRAFFIC_DOWN_WRITE", "RIGHT_APPLICATION_TRAFFIC_READ", // <----- "RIGHT_APPLICATION_TRAFFIC_UP_WRITE", ] } ```

Why do we need this?

Better UX since some users might think that when Read application traffic (uplink and downlink) is not selected, collaborators wont be able to observe application events, which is not true as long as Link as Application to a Network Server for traffic exchange, i.e. read uplink and write downlink is selected.

What is already there? What do you see now?

The stack implies certain rights https://github.com/TheThingsNetwork/lorawan-stack/blob/ff220a3188426b8cdc70613910f98fb6a2d73fdf/pkg/ttnpb/rights.go#L113-L118 based on rights selection. There is no obvious way for the user to be notified about this functionality in the console.

What is missing? What do you want to see?

Improved application rights selection in the Console.

Can you do this yourself and submit a Pull Request?

@kschiffer @ryaplots

kschiffer commented 2 years ago

Let's keep this simple and add a field description to RIGHT_APPLICATION_LINK reading

This implicitly includes the rights to view application information, read application traffic and write downlinks

@ryaplots can you pick this one up?