File tree 4 files changed +51
-3
lines changed
tests/integration/synapseclient/models 4 files changed +51
-3
lines changed Original file line number Diff line number Diff line change @@ -235,7 +235,10 @@ async def delete_permissions_async(
235
235
determined by its own ACL.
236
236
237
237
If the ACL of an Entity is deleted, then its benefactor will automatically be set
238
- to its parent's benefactor. The ACL for a Project cannot be deleted.
238
+ to its parent's benefactor.
239
+
240
+ **Special notice for Projects:** The ACL for a Project cannot be deleted, you
241
+ must individually update or revoke the permissions for each user or group.
239
242
240
243
Arguments:
241
244
include_self: If True (default), delete the ACL of the current entity.
@@ -411,6 +414,9 @@ async def _delete_current_entity_acl(
411
414
Exception: For any other errors that may occur during deletion.
412
415
"""
413
416
if not entity_info ["is_target_type" ] and entity_info ["entity_type" ] is not None :
417
+ client .logger .debug (
418
+ f"Skipping ACL deletion for entity { self .id } as its type '{ entity_info ['entity_type' ]} ' does not match the target types."
419
+ )
414
420
return
415
421
416
422
try :
Original file line number Diff line number Diff line change @@ -183,7 +183,10 @@ def delete_permissions(
183
183
determined by its own ACL.
184
184
185
185
If the ACL of an Entity is deleted, then its benefactor will automatically be set
186
- to its parent's benefactor. The ACL for a Project cannot be deleted.
186
+ to its parent's benefactor.
187
+
188
+ **Special notice for Projects:** The ACL for a Project cannot be deleted, you
189
+ must individually update or revoke the permissions for each user or group.
187
190
188
191
Arguments:
189
192
include_self: If True (default), delete the ACL of the current entity.
Original file line number Diff line number Diff line change @@ -859,4 +859,23 @@ async def test_delete_permissions_invalid_entity_type(
859
859
# AND the error message should mention allowed values
860
860
assert "Invalid entity type" in str (exc_info .value )
861
861
assert "folder" in str (exc_info .value )
862
- assert "file" in str (exc_info .value )
862
+
863
+ async def test_delete_permissions_on_new_project (
864
+ self , caplog : pytest .LogCaptureFixture
865
+ ) -> None :
866
+ """Test deleting permissions on a newly created project."""
867
+ # GIVEN a newly created project with custom permissions
868
+ project = await Project (name = f"test_project_{ uuid .uuid4 ()} " ).store_async ()
869
+ self .schedule_for_cleanup (project .id )
870
+
871
+ # AND custom permissions are set for authenticated users
872
+ await self ._set_custom_permissions (project )
873
+
874
+ # WHEN I delete permissions on the project
875
+ await project .delete_permissions_async ()
876
+
877
+ # THEN the permissions should not be deleted
878
+ assert (
879
+ "Cannot restore inheritance for resource which has no parent."
880
+ in caplog .text
881
+ )
Original file line number Diff line number Diff line change @@ -850,3 +850,23 @@ async def test_delete_permissions_invalid_entity_type(
850
850
assert "Invalid entity type" in str (exc_info .value )
851
851
assert "folder" in str (exc_info .value )
852
852
assert "file" in str (exc_info .value )
853
+
854
+ async def test_delete_permissions_on_new_project (
855
+ self , caplog : pytest .LogCaptureFixture
856
+ ) -> None :
857
+ """Test deleting permissions on a newly created project."""
858
+ # GIVEN a newly created project with custom permissions
859
+ project = await Project (name = f"test_project_{ uuid .uuid4 ()} " ).store_async ()
860
+ self .schedule_for_cleanup (project .id )
861
+
862
+ # AND custom permissions are set for authenticated users
863
+ await self ._set_custom_permissions (project )
864
+
865
+ # WHEN I delete permissions on the project
866
+ await project .delete_permissions ()
867
+
868
+ # THEN the permissions should not be deleted
869
+ assert (
870
+ "Cannot restore inheritance for resource which has no parent."
871
+ in caplog .text
872
+ )
You can’t perform that action at this time.
0 commit comments