Skip to content

Commit 8601f95

Browse files
Add missing custom permissions for test storage and sync deployment actions (#932)
* fix(permissions): add missing custom permissions for test storage and sync deployment to project managers * fix(tests): Added missing permission to storage permissions test * Merged migrations * chore: recreate migrations on main --------- Co-authored-by: Michael Bunsen <notbot@gmail.com>
1 parent 47fed9a commit 8601f95

File tree

4 files changed

+65
-1
lines changed

4 files changed

+65
-1
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Generated by Django 4.2.10 on 2025-09-03 16:24
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("main", "0070_alter_project_feature_flags"),
9+
]
10+
11+
operations = [
12+
migrations.AlterModelOptions(
13+
name="project",
14+
options={
15+
"ordering": ["-priority", "created_at"],
16+
"permissions": [
17+
("create_identification", "Can create identifications"),
18+
("update_identification", "Can update identifications"),
19+
("delete_identification", "Can delete identifications"),
20+
("create_job", "Can create a job"),
21+
("update_job", "Can update a job"),
22+
("run_ml_job", "Can run/retry/cancel ML jobs"),
23+
("run_populate_captures_collection_job", "Can run/retry/cancel Populate Collection jobs"),
24+
("run_data_storage_sync_job", "Can run/retry/cancel Data Storage Sync jobs"),
25+
("run_data_export_job", "Can run/retry/cancel Data Export jobs"),
26+
("run_single_image_ml_job", "Can process a single capture"),
27+
("delete_job", "Can delete a job"),
28+
("create_deployment", "Can create a deployment"),
29+
("delete_deployment", "Can delete a deployment"),
30+
("update_deployment", "Can update a deployment"),
31+
("sync_deployment", "Can sync images to a deployment"),
32+
("create_sourceimagecollection", "Can create a collection"),
33+
("update_sourceimagecollection", "Can update a collection"),
34+
("delete_sourceimagecollection", "Can delete a collection"),
35+
("populate_sourceimagecollection", "Can populate a collection"),
36+
("create_sourceimage", "Can create a source image"),
37+
("update_sourceimage", "Can update a source image"),
38+
("delete_sourceimage", "Can delete a source image"),
39+
("star_sourceimage", "Can star a source image"),
40+
("create_sourceimageupload", "Can create a source image upload"),
41+
("update_sourceimageupload", "Can update a source image upload"),
42+
("delete_sourceimageupload", "Can delete a source image upload"),
43+
("create_s3storagesource", "Can create storage"),
44+
("delete_s3storagesource", "Can delete storage"),
45+
("update_s3storagesource", "Can update storage"),
46+
("test_s3storagesource", "Can test storage connection"),
47+
("create_site", "Can create a site"),
48+
("delete_site", "Can delete a site"),
49+
("update_site", "Can update a site"),
50+
("create_device", "Can create a device"),
51+
("delete_device", "Can delete a device"),
52+
("update_device", "Can update a device"),
53+
("view_private_data", "Can view private data"),
54+
("trigger_exports", "Can trigger data exports"),
55+
],
56+
},
57+
),
58+
]

ami/main/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ class Permissions:
318318
CREATE_DEPLOYMENT = "create_deployment"
319319
DELETE_DEPLOYMENT = "delete_deployment"
320320
UPDATE_DEPLOYMENT = "update_deployment"
321+
SYNC_DEPLOYMENT = "sync_deployment"
321322

322323
# Collection permissions
323324
CREATE_COLLECTION = "create_sourceimagecollection"
@@ -339,6 +340,7 @@ class Permissions:
339340
CREATE_STORAGE = "create_s3storagesource"
340341
DELETE_STORAGE = "delete_s3storagesource"
341342
UPDATE_STORAGE = "update_s3storagesource"
343+
TEST_STORAGE = "test_s3storagesource"
342344

343345
# Site permissions
344346
CREATE_SITE = "create_site"
@@ -377,6 +379,7 @@ class Meta:
377379
("create_deployment", "Can create a deployment"),
378380
("delete_deployment", "Can delete a deployment"),
379381
("update_deployment", "Can update a deployment"),
382+
("sync_deployment", "Can sync images to a deployment"),
380383
# Collection permissions
381384
("create_sourceimagecollection", "Can create a collection"),
382385
("update_sourceimagecollection", "Can update a collection"),
@@ -395,6 +398,7 @@ class Meta:
395398
("create_s3storagesource", "Can create storage"),
396399
("delete_s3storagesource", "Can delete storage"),
397400
("update_s3storagesource", "Can update storage"),
401+
("test_s3storagesource", "Can test storage connection"),
398402
# Site permissions
399403
("create_site", "Can create a site"),
400404
("delete_site", "Can delete a site"),

ami/main/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ def setUp(self) -> None:
12831283
"project_manager": {
12841284
"project": {"create": False, "update": True, "delete": True},
12851285
"collection": {"create": True, "update": True, "delete": True, "populate": True},
1286-
"storage": {"create": True, "update": True, "delete": True},
1286+
"storage": {"create": True, "update": True, "delete": True, "test": True},
12871287
"sourceimage": {"create": True, "update": True, "delete": True},
12881288
"sourceimageupload": {"create": True, "update": True, "delete": True},
12891289
"site": {"create": True, "update": True, "delete": True},

ami/users/roles.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ class ProjectManager(Role):
105105
Project.Permissions.CREATE_STORAGE,
106106
Project.Permissions.UPDATE_STORAGE,
107107
Project.Permissions.DELETE_STORAGE,
108+
Project.Permissions.TEST_STORAGE,
108109
Project.Permissions.CREATE_DEPLOYMENT,
109110
Project.Permissions.UPDATE_DEPLOYMENT,
110111
Project.Permissions.DELETE_DEPLOYMENT,
112+
Project.Permissions.SYNC_DEPLOYMENT,
111113
Project.Permissions.CREATE_SITE,
112114
Project.Permissions.UPDATE_SITE,
113115
Project.Permissions.DELETE_SITE,

0 commit comments

Comments
 (0)