-
Notifications
You must be signed in to change notification settings - Fork 5
Support for draft projects & private draft permissions #917
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
Merged
Merged
Changes from 61 commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
9c8a432
Moved permission checks to the BaseModel class
mohamedelabbas1996 4fdae24
Refactor Job model permission checks to include job type for finer-gr…
mohamedelabbas1996 c43ef9c
Added fine-grained permissions for each job type
mohamedelabbas1996 4407af1
Modified roles to use the fine-grained job permissions
mohamedelabbas1996 1ec1595
Updated views to use the new permission checks
mohamedelabbas1996 c4de3de
Removed old job permissions from tests
mohamedelabbas1996 43d7bbf
Added migration file
mohamedelabbas1996 35a6ea8
Merge branch 'main' into feat/restrict-ml-processing-jobs
mohamedelabbas1996 b4ef1bc
Added permission for processing single source image
mohamedelabbas1996 a83e919
Merge branch 'feat/restrict-ml-processing-jobs' of https://github.com…
mohamedelabbas1996 095b899
Changed PermissionError to PermissionDenied
mohamedelabbas1996 c694706
Added migration file
mohamedelabbas1996 5515a87
Merge branch 'main' into feat/restrict-ml-processing-jobs
mohamedelabbas1996 3fc6906
Merge branch 'main' into feat/restrict-ml-processing-jobs
mohamedelabbas1996 5123aef
tests: Added tests for fine-grained job run permission
mohamedelabbas1996 805f87b
Move process single source image permission from source image to job …
mohamedelabbas1996 e995d9d
Added migration files
mohamedelabbas1996 cdbae94
Remove process_sourceimage permission from job details response
mohamedelabbas1996 22882a6
Added type hints
mohamedelabbas1996 a7eab7a
Modified process single image permission name
mohamedelabbas1996 4ee7e53
Added migration file
mohamedelabbas1996 7adf27d
Changed tests to check for run single image permission in the job det…
mohamedelabbas1996 9642ab7
chore: update FE permission handling for processing single captures
annavik b4e16ad
chore: update FE permission handling to use single run permission
annavik f385af3
Squashed migrations
mohamedelabbas1996 a9b39d7
Merge branch 'feat/restrict-ml-processing-jobs' of https://github.com…
mohamedelabbas1996 d166865
Merge branch 'main' into feat/restrict-ml-processing-jobs
mohamedelabbas1996 a15e9cf
Cleaned up permission check classes defined for each model and used a…
mohamedelabbas1996 19deb5f
Cleaned up BaseModel permission checks
mohamedelabbas1996 952e5ff
Returned run_single_image_ml_job permission with the source image object
mohamedelabbas1996 4824df3
Implemented custom permission checks for the identification model to …
mohamedelabbas1996 28c605d
Removed generic job run, cancel and retry permissions
mohamedelabbas1996 1f8b0e2
Revoked ml job run permission
mohamedelabbas1996 737da22
Merge branch 'feat/restrict-ml-processing-jobs' of https://github.com…
mohamedelabbas1996 81fc2a9
Added a migration to delete deprecated job permissions
mohamedelabbas1996 e215ac9
Added tests to make sure that job permissions are returned correctly …
mohamedelabbas1996 6a16ac0
Changed permission name for run single image
mohamedelabbas1996 4e045e5
Added tests for single image ml job
mohamedelabbas1996 38b7fdf
Delete migration file
mohamedelabbas1996 d7028e7
Merge branch 'main' into feat/restrict-ml-processing-jobs
mohamedelabbas1996 2f87531
Fixed conflicting migrations issue
mohamedelabbas1996 591f7a4
Add draft field to Project model
mohamedelabbas1996 46d76fe
Cleaned project permissions names
mohamedelabbas1996 b128148
Added view permission check for draft projects
mohamedelabbas1996 4014a95
Added draft field to the project admin page
mohamedelabbas1996 987e30b
Added tests for draft project view permission
mohamedelabbas1996 eb2d5f9
Added BaseQuerySet with draft project visibility filter
mohamedelabbas1996 b57c373
Use BaseQuerySet and define project_accessor on models
mohamedelabbas1996 5366727
Add helper to check user access to draft projects
mohamedelabbas1996 c1e4a94
Filter queryset in default viewset based on draft project visibility
mohamedelabbas1996 0a72691
Added tests for draft project and related object listing
mohamedelabbas1996 955b345
Optimize visible_draft_projects_only in BaseQuerySet to improve filte…
mohamedelabbas1996 82ac8ec
Add project_accessor string to models to specify their relationship t…
mohamedelabbas1996 231a534
Clean base queryset filter method logic
mohamedelabbas1996 d7f3c03
Modify summary endpoint to stats only from visible draft projects
mohamedelabbas1996 7f60b4d
Merge branch 'main' into feat/restrict-draft-projects-permissions
mohamedelabbas1996 d5e3643
Fixed formatting errors
mohamedelabbas1996 58375df
Fixed draft project filtering for PipelineQuerySet
mohamedelabbas1996 c5b1fd4
Merged migrations
mohamedelabbas1996 2331e83
Added tests for draft project related deployment objects
mohamedelabbas1996 f292829
Fixed formatting errors
mohamedelabbas1996 2736ca8
chore: rebase migrations on top of what's in main
mihow 0fdb221
chore: add missing migration
mihow f73348b
Use project accessor only for models with indirect one to many relati…
mohamedelabbas1996 94797d4
Change BaseQuerySet filter method name to visible_for_user
mohamedelabbas1996 b03b4a8
Modify the ProcessingServiceManager to inherit the BaseQuerySet
mohamedelabbas1996 35d94a2
Add tests for visible_for_user filter method
mohamedelabbas1996 788e87b
feat: add test for comparing public & private summary counts
mihow 8fc5927
feat: check exact counts in summary stats tests
mihow 670284a
Merge branch 'main' of github.com:RolnickLab/antenna into feat/restri…
mihow 35e28d2
fix: rebase migrations
mihow a2bd161
feat: check if self is a Project rather than using empty string
mihow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from django.db import migrations | ||
|
||
|
||
def delete_deprecated_permissions(apps, schema_editor): | ||
Permission = apps.get_model("auth", "Permission") | ||
ContentType = apps.get_model("contenttypes", "ContentType") | ||
|
||
deprecated_codenames = [ | ||
"process_sourceimage", | ||
"process_single_image_job", | ||
"process_single_image_ml_job", | ||
"run_job", | ||
"retry_job", | ||
"cancel_job", | ||
] | ||
|
||
permissions = Permission.objects.filter(codename__in=deprecated_codenames) | ||
for perm in permissions: | ||
print(f"Deleting permission: {perm.codename}") | ||
perm.delete() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("main", "0058_alter_project_options_squashed_0067_alter_project_options"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(delete_deprecated_permissions, reverse_code=migrations.RunPython.noop), | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Generated by Django 4.2.10 on 2025-07-09 00:24 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("main", "0059_delete_deprecated_permissions"), | ||
("main", "0060_alter_sourceimagecollection_method"), | ||
] | ||
|
||
operations = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.10 on 2025-08-11 07:46 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("main", "0061_merge_20250709_0024"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="project", | ||
name="draft", | ||
field=models.BooleanField(default=False, help_text="Indicates whether this project is in draft mode"), | ||
), | ||
] |
12 changes: 12 additions & 0 deletions
12
ami/main/migrations/0070_merge_0062_project_draft_0069_merge_20250818_1201.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Generated by Django 4.2.10 on 2025-08-22 16:04 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("main", "0062_project_draft"), | ||
("main", "0069_merge_20250818_1201"), | ||
] | ||
|
||
operations = [] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.