Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

token based report #6216

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open

token based report #6216

wants to merge 27 commits into from

Conversation

pjain1
Copy link
Member

@pjain1 pjain1 commented Dec 5, 2024

Changes:

  • This PR changes all the report links to always have a magic token.
  • Magic tokens are created for each run of the report with expiry of 60 days for both internal and external users.
  • This enables the links to never expire and everytime its clicked it just works (if user is removed or added etc. in all scenarios) unless the token expires.

UI changes needed:

  • Report Creation API - Since even external users can now open the report in explore, the API now expects either the (metrics view and explore name) or canvas name on which report is created. UI also needs to specify a open mode which indicates if open link should be created for the user or not. It has following options
open_mode: legacy|none|creator|filter
open_filter: <filter to use if open_mode=filter>

- `legacy` (default): if the email is not a Rill user, don't provide an open link; otherwise, provide an open link without a magic token (so it uses their current credentials)
- `none`: don't provide an open link
- `creator`: provide an open link with a magic token that has the same attributes as the report creator
- `filter` (later): provide an open link with magic token that has the same attributes as the report creator, but filtered by `open_filter`
  • Report Edit API - should include open_mode in the request now.
  • Open link - open link will have magic token and can be used to show the explore (similar to a public URL). If a user is logged in, it should display a banner to say "this is a preview link" or something like that (may need product input here). The report's token may have different permissions/attributes than the current user (e.g. if the report was created by an admin, but the recipient is not an admin), so it cannot simply show the dashboard as the current user.
  • Download link - use token to enable download, it already happens for external user now so probably only removing internal download page (if exists).
  • Unsubscribe link - It will need to grab the email or slack_user query param from the url and call the unsubscribe API with this param.

Important Note: This does not support locking time ranges as of now (locking dimension filter works), as they would be evaluated during each report run at runtime. The queries that are sent by explore have a separate time range apart from the filter, magic token only supports row filter. If mgc token has time range then it will need to be reconciled with the actual time range sent.

Contributes to https://github.com/orgs/rilldata/projects/38/views/8?pane=issue&itemId=85181742&issue=rilldata%7Crill-private-issues%7C855

@pjain1 pjain1 marked this pull request as draft December 5, 2024 11:22
@pjain1 pjain1 requested a review from begelundmuller December 9, 2024 15:42
@pjain1 pjain1 marked this pull request as ready for review December 9, 2024 15:43
Copy link
Contributor

@begelundmuller begelundmuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, do we have a job that clears expired magic auth tokens periodically? If not, can you add one?

@pjain1
Copy link
Member Author

pjain1 commented Dec 16, 2024

Also, do we have a job that clears expired magic auth tokens periodically? If not, can you add one?

There is already a deleteExpiredAuthTokens job that will take care of it since we set an expiry.

@begelundmuller
Copy link
Contributor

begelundmuller commented Dec 27, 2024

@pjain1 I responded to the two open questions on this PR. Can you let me know when you address them (or if you decide they are not worth it) and fix the merge conflict?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants