Skip to content

Share unpublished components with manageable tokens#6271

Merged
tramuntanal merged 43 commits intodecidim:developfrom
Platoniq:feature/share-tokens
Sep 8, 2020
Merged

Share unpublished components with manageable tokens#6271
tramuntanal merged 43 commits intodecidim:developfrom
Platoniq:feature/share-tokens

Conversation

@verarojman
Copy link
Copy Markdown
Contributor

@verarojman verarojman commented Jul 2, 2020

🎩 What? Why?

As part of the development of #6176, the need for a system that allows sharing unpublished components with non-admin users has arised. This PR adds a token system to share unpublished components (easily extendable to other resources) and manage these tokens from the component's configuration screen.

Tokens store the user that created them, as well as the times it is used, the last time used and its expiration date to better control access to these unpublished resources.

📌 Related Issues

📋 Subtasks

  • Add documentation regarding the feature
  • Add tests
    • System spec for sharing and managing tokens
    • Model spec for tokens
    • Permissions spec for accessing an unpublished component with a token

📷 Screenshots

Manage-tokens-2

@verarojman verarojman changed the title [WIP] [Feature] Share unpublished components with managable tokens [WIP] [Feature] Share unpublished components with manageable tokens Jul 3, 2020
@verarojman verarojman changed the title [Feature] Share unpublished components with manageable tokens Share unpublished components with manageable tokens Jul 13, 2020
@ivan-mr ivan-mr self-requested a review July 15, 2020 06:35
@ivan-mr
Copy link
Copy Markdown
Contributor

ivan-mr commented Jul 15, 2020

I've found a bug. When there's more than one share token (I've test it with 3) from differents components, the visit counter don't work properly. It only increments with one token and not for all.
I show en example with the following video:
problem_share_token

I've created first of all, a token for a survey that works fine. Then I've created a second token on another component (blog) that works fine. But for the third token (on the first component, the survey) I've check that there's no response changing the counter visit for it and also occured the same the first token. The only counter that increases is the blog token

@verarojman
Copy link
Copy Markdown
Contributor Author

verarojman commented Jul 15, 2020

Hi @ivan-mr, thanks for the review!

The visit counter is not incrementing for those tokens because the components are published, thus not needing tokens to be accessed. Since the permissions resolve once the component is checked to be published, the share token is not fetched or modified, despite being present in the url.

Seeing it might be misleading for some users, maybe tokens for a component should be deleted (*or hidden) when the component gets published? @decidim/product @microstudi want to share any thoughts on this?

Edit: For now I'll just hide tokens when the component is not published.

I've found a bug. When there's more than one share token (I've test it with 3) from differents components, the visit counter don't work properly. It only increments with one token and not for all.
I show en example with the following video:
(...)

I've created first of all, a token for a survey that works fine. Then I've created a second token on another component (blog) that works fine. But for the third token (on the first component, the survey) I've check that there's no response changing the counter visit for it and also occured the same the first token. The only counter that increases is the blog token

@ivan-mr
Copy link
Copy Markdown
Contributor

ivan-mr commented Jul 15, 2020

I found the code correct. But I will still wait for the @decidim/product response on this small change in functionality.
Thanks @verarojman !

@andreslucena
Copy link
Copy Markdown
Member

Seeing it might be misleading for some users, maybe tokens for a component should be deleted (*or hidden) when the component gets published? @decidim/product @microstudi want to share any thoughts on this?

For me, this "Share tokens" screen has a UX issue that's inherited from the rest of the admin panel: that we don't explain much about how this works and its behavior. I think that we should explain a bit about how it works and also that these tokens will get destroyed when the component is published.

@tramuntanal
Copy link
Copy Markdown
Contributor

@verarojman would you be so kind to add an explanatory text in the "Share tokens" panel explaining

how it works and also that these tokens will get destroyed when the component is published

@carolromero
Copy link
Copy Markdown
Member

@tramuntanal I've reviewed this PR and looks good to me. Thanks for the contribution @verarojman!

@tramuntanal tramuntanal merged commit d674463 into decidim:develop Sep 8, 2020
andreslucena added a commit to decidim/documentation that referenced this pull request Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants