Skip to content

Commit 50dbf83

Browse files
authored
[SYNPY-1604] delete_permissions dry_run flag and list_acl method (#1207)
* Creation of a dry_run flag in delete_permissions and listing the ACL tree given a container or entity * Support the TQDM progress bar during deleting/listing ACL
1 parent d9998ef commit 50dbf83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+8815
-956
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
path: |
8484
${{ steps.get-dependencies.outputs.site_packages_loc }}
8585
${{ steps.get-dependencies.outputs.site_bin_dir }}
86-
key: ${{ runner.os }}-${{ matrix.python }}-build-${{ env.cache-name }}-${{ hashFiles('setup.py') }}-v23
86+
key: ${{ runner.os }}-${{ matrix.python }}-build-${{ env.cache-name }}-${{ hashFiles('setup.py') }}-v24
8787

8888
- name: Install py-dependencies
8989
if: steps.cache-dependencies.outputs.cache-hit != 'true'

docs/explanations/access_control.md

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,90 @@
11
# Access Control
22

3-
By default, data sets in Synapse are private to your user account, but they can easily be shared with specific users, groups, or the public.
3+
Access Control Lists (ACLs) in Synapse are the foundation of data security and sharing. They determine who can access your data and what actions they can perform. By default, all entities in Synapse are private to your user account, but they can be easily shared with specific users, groups, or made publicly accessible.
44

5-
See:
5+
## Core Concepts
66

7+
### Access Control Lists (ACLs)
8+
An ACL is a set of permissions that define what actions specific users or groups can perform on a Synapse entity. Each ACL entry specifies:
9+
10+
- **Principal**: The user, team, or special group being granted permissions
11+
- **Permissions**: The specific actions they can perform
12+
13+
### Benefactors and Inheritance
14+
Every entity in Synapse has a **benefactor** - the entity from which it inherits its permissions:
15+
16+
- **Default Inheritance**: New entities inherit permissions from their parent container
17+
- **Local ACLs**: When you create custom sharing settings, the entity becomes its own benefactor
18+
- **Permission Resolution**: Synapse traverses up the hierarchy to find the benefactor with ACL settings
19+
20+
### Permission Types
21+
Synapse supports several permission types that can be combined:
22+
23+
- **READ**: View entity metadata and basic information
24+
- **DOWNLOAD**: Download files and data (requires READ)
25+
- **UPDATE**: Modify entity metadata and upload new file versions
26+
- **CREATE**: Create new entities within containers
27+
- **DELETE**: Delete entities
28+
- **CHANGE_PERMISSIONS**: Modify ACL permissions
29+
- **CHANGE_SETTINGS**: Modify entity settings
30+
- **MODERATE**: Moderate forum discussions (for projects)
31+
32+
Other synapse items like `Submission` and `Evaluation` support different permission types not covered in this document.
33+
34+
### Special Principal IDs
35+
Synapse provides special principals for common sharing scenarios:
36+
37+
- **273948**: All authenticated Synapse users
38+
- **273949**: Public access (anyone on the internet)
39+
- **Specific User ID**: Individual Synapse users (e.g., #######)
40+
- **Team ID**: Synapse teams for group-based permissions (e.g., #######)
41+
42+
## Common Use Cases
43+
44+
### Research Collaboration
45+
- **Internal Teams**: Grant READ/DOWNLOAD to collaborators
46+
- **Data Owners**: Maintain full permissions (including UPDATE/DELETE)
47+
- **Public Data**: Use public principal (273949) for open datasets
48+
49+
### Hierarchical Access Control
50+
- **Project Level**: Set broad permissions for the entire project
51+
- **Folder Level**: Override with more restrictive permissions for sensitive data
52+
- **File Level**: Fine-grained control for specific datasets
53+
54+
### Data Governance
55+
- **Sensitive Data**: Create local ACLs with restricted access
56+
- **Compliance**: Use teams for role-based access control
57+
- **Auditing**: Use `list_acl()` to review permission structures
58+
59+
## Best Practices
60+
61+
1. **Use Inheritance**: Leverage the default inheritance model when possible for easier management
62+
2. **Minimal Local ACLs**: Only create custom ACLs when you need different permissions than the parent
63+
3. **Team-Based Permissions**: Use Synapse teams for group permissions rather than individual users
64+
4. **Regular Audits**: Periodically review ACLs using `list_acl()` to ensure appropriate access
65+
5. **Dry Run Testing**: Use `dry_run=True` when deleting permissions to preview changes
66+
6. **Documentation**: Document your permission structure for team understanding
67+
68+
## Security Considerations
69+
70+
- **Principle of Least Privilege**: Grant only the minimum permissions necessary
71+
- **Regular Reviews**: Audit permissions regularly, especially for sensitive data
72+
- **Team Management**: Use teams to simplify permission management and reduce errors
73+
- **Public Access**: Be cautious when granting public access (273949) to ensure data is appropriate for public consumption
74+
75+
## Learn More
76+
77+
For hands-on experience with ACL management, follow the comprehensive [Sharing Settings Tutorial](../tutorials/python/sharing_settings.md), which demonstrates all aspects of permission management using real examples.
78+
79+
## API References
80+
81+
### Object-Oriented Models
82+
- [get_permissions()][synapseclient.models.protocols.access_control_protocol.AccessControllableSynchronousProtocol.get_permissions]
83+
- [get_acl()][synapseclient.models.protocols.access_control_protocol.AccessControllableSynchronousProtocol.get_acl]
84+
- [set_permissions()][synapseclient.models.protocols.access_control_protocol.AccessControllableSynchronousProtocol.set_permissions]
85+
- [list_acl()][synapseclient.models.protocols.access_control_protocol.AccessControllableSynchronousProtocol.list_acl]
86+
- [delete_permissions()][synapseclient.models.protocols.access_control_protocol.AccessControllableSynchronousProtocol.delete_permissions]
87+
88+
### Legacy API Methods
789
- [synapseclient.Synapse.getPermissions][]
890
- [synapseclient.Synapse.setPermissions][]

docs/reference/experimental/async/dataset.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ at your own risk.
2828
- get_acl_async
2929
- set_permissions_async
3030
- delete_permissions_async
31+
- list_acl_async
3132
---
3233
[](){ #entity-ref-reference-async }
3334
::: synapseclient.models.EntityRef

docs/reference/experimental/async/dataset_collection.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ at your own risk.
2828
- get_acl_async
2929
- set_permissions_async
3030
- delete_permissions_async
31+
- list_acl_async
3132
---
3233
[](){ #entity-ref-dataset-collection-reference-async }
3334
::: synapseclient.models.EntityRef

docs/reference/experimental/async/entityview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ at your own risk.
2525
- get_permissions_async
2626
- set_permissions_async
2727
- delete_permissions_async
28+
- list_acl_async
2829
---
2930

3031
[](){ #view-type-mask-reference }

docs/reference/experimental/async/file.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ at your own risk.
2222
- get_acl_async
2323
- set_permissions_async
2424
- delete_permissions_async
25+
- list_acl_async
2526
---
2627
[](){ #filehandle-reference-async }
2728
::: synapseclient.models.file.FileHandle

docs/reference/experimental/async/folder.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ at your own risk.
1919
- get_acl_async
2020
- set_permissions_async
2121
- delete_permissions_async
22+
- list_acl_async

docs/reference/experimental/async/materializedview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ at your own risk.
1919
- get_acl_async
2020
- set_permissions_async
2121
- delete_permissions_async
22+
- list_acl_async

docs/reference/experimental/async/project.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ at your own risk.
1818
- get_acl_async
1919
- set_permissions_async
2020
- delete_permissions_async
21+
- list_acl_async

docs/reference/experimental/async/table.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ at your own risk.
2727
- get_acl_async
2828
- set_permissions_async
2929
- delete_permissions_async
30+
- list_acl_async
3031

3132
[](){ #column-reference-async }
3233
::: synapseclient.models.Column

0 commit comments

Comments
 (0)