Skip to content

Commit 4ada222

Browse files
authored
Merge pull request #759 from superannotateai/fix_invite
Fix add_contributors_to_project
2 parents 32263f9 + 045d458 commit 4ada222

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

docs/source/api_reference/api_team.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ Team
1010
.. automethod:: superannotate.SAClient.get_user_metadata
1111
.. automethod:: superannotate.SAClient.set_user_custom_field
1212
.. automethod:: superannotate.SAClient.list_users
13+
.. automethod:: superannotate.SAClient.pause_user_activity
14+
.. automethod:: superannotate.SAClient.resume_user_activity

src/superannotate/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44

55

6-
__version__ = "4.4.31dev1"
6+
__version__ = "4.4.31dev2"
77

88
os.environ.update({"sa_version": __version__})
99
sys.path.append(os.path.split(os.path.realpath(__file__))[0])

src/superannotate/lib/app/interface/sdk_interface.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,16 @@ def list_users(self, *, include: List[Literal["custom_fields"]] = None, **filter
461461
def pause_user_activity(
462462
self, pk: Union[int, str], projects: Union[List[int], List[str], Literal["*"]]
463463
):
464+
"""
465+
Block the team contributor from requesting items from the projects.
466+
467+
:param pk: The email address or user ID of the team contributor.
468+
:type pk: str or int
469+
470+
:param projects: A list of project names or IDs from which the user should be blocked.
471+
The special value "*" means block access to all projects
472+
:type projects: Union[List[int], List[str], Literal["*"]]
473+
"""
464474
user = self.controller.work_management.get_user_metadata(pk=pk)
465475
if user.role is not WMUserTypeEnum.Contributor:
466476
raise AppException("User must have a contributor role to pause activity.")
@@ -474,6 +484,16 @@ def pause_user_activity(
474484
def resume_user_activity(
475485
self, pk: Union[int, str], projects: Union[List[int], List[str], Literal["*"]]
476486
):
487+
"""
488+
Resume the team contributor from requesting items from the projects.
489+
490+
:param pk: The email address or user ID of the team contributor.
491+
:type pk: str or int
492+
493+
:param projects: A list of project names or IDs from which the user should be resumed.
494+
The special value "*" means resume access to all projects
495+
:type projects: Union[List[int], List[str], Literal["*"]]
496+
"""
477497
user = self.controller.work_management.get_user_metadata(pk=pk)
478498
if user.role is not WMUserTypeEnum.Contributor:
479499
raise AppException("User must have a contributor role to resume activity.")

src/superannotate/lib/infrastructure/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,12 @@ def sync(self, project: ProjectEntity):
148148
roles = response.data["data"]
149149
self._K_V_map[project.id] = {
150150
"role_name_id_map": {
151-
role["role"]["name"]: role["role_id"] for role in roles
151+
**{role["role"]["name"]: role["role_id"] for role in roles},
152+
"ProjectAdmin": 3,
152153
},
153154
"role_id_name_map": {
154-
role["role_id"]: role["role"]["name"] for role in roles
155+
**{role["role_id"]: role["role"]["name"] for role in roles},
156+
3: "ProjectAdmin",
155157
},
156158
}
157159
self._update_cache_timestamp(project.id)

0 commit comments

Comments
 (0)