Skip to content

Commit d7bc471

Browse files
committed
Possibility to pass workspace and project role as a string (beside the Enums)
1 parent eb00114 commit d7bc471

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/dev/integration/index.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ You can create new users and manage their roles using the following methods.
5454
The following methods are available for Python API Client versions `0.10.0` or higher, using server versions `2025.2.0` or higher.
5555
:::
5656

57-
Some of the following methods require a `workspace_role` argument. This must be provided as a member of the `WorkspaceRole` enum.
58-
To use the enum, import it from the `common.py` module:
59-
6057
```python
6158
from mergin.common import WorkspaceRole
6259
```
@@ -77,7 +74,11 @@ Arguments:
7774

7875
`workspace_id` (int) <span title="Ignored on Community edition servers">:information_source:</span> : The workspace ID where the user will be added.
7976

80-
`workspace_role` (`WorkspaceRole` enum) <span title="Ignored on Community edition servers">:information_source:</span> : The user’s role in the workspace. [See the roles options](../../manage/permissions/index.md#workspace-member-roles-overview).
77+
`workspace_role` (string or `WorkspaceRole` enum) <span title="Ignored on Community edition servers">:information_source:</span> : The user’s role in the workspace.
78+
79+
- String: Pass the role name directly (e.g., "guest", "reader", "editor").
80+
- Enum: Pass a member of the `WorkspaceRole` enum (requires importing from mergin.common)
81+
- [See the roles options](../../manage/permissions/index.md#workspace-member-roles-overview).
8182

8283
`username` (string, optional): If not provided, it will be automatically generated from the email address.
8384

@@ -135,7 +136,7 @@ Arguments:
135136

136137
`user_id` (int): ID of the user.
137138

138-
`workspace_role` (`WorkspaceRole` enum): New role. [See the roles options](../../manage/permissions/index.md#workspace-member-roles-overview).
139+
`workspace_role` (string or `WorkspaceRole` enum): New role. [See the roles options](../../manage/permissions/index.md#workspace-member-roles-overview).
139140

140141
`reset_projects_roles` (Boolean, optional): If true, overridden project roles (explicitly shared projects access) will be reset. Default is `False`.
141142

@@ -168,7 +169,7 @@ Arguments:
168169

169170
`email` (string): The email of an existing user.
170171

171-
`workspace_role` (`WorkspaceRole` enum): The user’s role in the workspace. [See the roles options](../../manage/permissions/index.md#workspace-member-roles-overview).
172+
`workspace_role` (string or `WorkspaceRole` enum): The user’s role in the workspace. [See the roles options](../../manage/permissions/index.md#workspace-member-roles-overview).
172173

173174
---
174175

@@ -184,12 +185,6 @@ The caller of the following methods must be a workspace admin, owner, project ow
184185

185186
The following methods accept project ids (of type `uuid`). You can find project id via <GitHubRepo id="MerginMaps/python-api-client/blob/634237890afd9f28f03953e5a01376b56f5abf5c/mergin/client.py#L572" desc="projects_list" /> and <GitHubRepo id="MerginMaps/python-api-client/blob/634237890afd9f28f03953e5a01376b56f5abf5c/mergin/client.py#L641" desc="project_info" /> methods.
186187

187-
Some of the following methods require a `project_role` argument. This must be provided as a member of the `ProjectRole` enum.
188-
To use the enum, import it from the `common.py` module:
189-
190-
```python
191-
from mergin.common import ProjectRole
192-
```
193188

194189
#### List project collaborators
195190

@@ -206,6 +201,7 @@ Adds a user as project collaborator. This method is good for sharing projects wi
206201
On Cloud, the user must be a in the workspace where the project belongs.
207202

208203
```python
204+
from mergin.common import ProjectRole
209205
client.add_project_collaborator(<project_id>, <user>, <project_role>)
210206
```
211207
Arguments:
@@ -214,7 +210,11 @@ Arguments:
214210

215211
`user` (string): Email or username of the user to be added to the project.
216212

217-
`project_role`: (`ProjectRole` enum): Role of the user in the project. [See the roles options](../../manage/permissions/index.md#project-permissions-overview)
213+
`project_role`: (string or `ProjectRole` enum): Role of the user in the project.
214+
215+
- String: Pass the role name directly (e.g., 'reader', 'editor', 'owner').
216+
- Enum: Pass a member of the `ProjectRole` enum (requires importing from mergin.common)
217+
- [See the roles options](../../manage/permissions/index.md#project-permissions-overview)
218218

219219
#### Update project collaborator role
220220

@@ -227,7 +227,7 @@ Arguments:
227227

228228
`user_id` (int): ID of the user.
229229

230-
`project_role`: (`ProjectRole` enum): New role. [See the roles options](../../manage/permissions/index.md#project-permissions-overview)
230+
`project_role`: (string or `ProjectRole` enum): New role. [See the roles options](../../manage/permissions/index.md#project-permissions-overview)
231231

232232
> The user must be first added to the project (via [Add project collaborator](./index.md#add-project-collaborator)) before calling this method, even if he/she is already a workspace member or guest.
233233

0 commit comments

Comments
 (0)