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

Permissions attribute for targets, filtering logic and migrations #1175

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from

Conversation

Fingel
Copy link
Contributor

@Fingel Fingel commented Feb 6, 2025

Adds a permissions field on the Target that allows for filtering prior to doing row-level permissions for open/public targets. This significantly improves performance for TOMs with large datasets that are mostly open or public.

Included migrations should handle the transition transparently.

Todo:

  • Extend filtering logic beyond the TargetList view.
  • Update target creation logic away from the Public group.
  • Apply logic to non-target models?
  • Tests.
  • Clean up any remaining 'Public' group logic.
  • Update documentation.

Adds a permissions field on the Target that allows for filtering prior
to doing row-level permissions for open/public targets. This
significantly improves performance for TOMs with large datasets that are
mostly open or public.

Included migrations should handle the transition transparently.

Todo:

[] Extend filtering logic beyond the TargetList view.
[] Update target creation logic away from the Public group.
[] Apply logic to non-target models?
[] Tests.
[] Clean up any remaining 'Public' group logic.
[] Update documentation.
It doesn't make a lot of sense to display the group form on the target
create/update forms if the target is not private. This commit introduces
a UI using a small amount of javascript that will hide the group form
unless the user sets the target to private.

Because this wasn't possible to implement with the generic form
rendering in use, this commit also updates the target update
and create forms to use a more compact layout instead of
placing every field on a single row, increasing usability.
The fields will still collapse to single rows on
narrow viewports.

Custom target types will default to the generic form rendering as
before.
@Fingel Fingel marked this pull request as ready for review February 13, 2025 22:19
@Fingel Fingel requested review from jchate6 and phycodurus February 13, 2025 22:20
@@ -306,6 +311,10 @@ class BaseTarget(models.Model):
auto_now=True, verbose_name='Last Modified',
help_text='The time which this target was changed in the TOM database.'
)
permissions = models.CharField(
max_length=100, default=Permissions.PUBLIC, choices=Permissions.choices,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we set the default to private? It's possible people have built pipelines already with the assumption that newly created targets will have row-level permissions enforced.

@@ -35,3 +34,6 @@ <h3>Tags</h3>
{% endbuttons %}
</form>
{% endblock %}
{% block extra_javascript %}
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alpine.js is going to be useful for some of the other stories relating to making the UI more responsive. I'm not up to date on how we are handling static assets, but at the least this can be moved to base.html.

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

Successfully merging this pull request may close these issues.

1 participant