Skip to content

Commit 009e95e

Browse files
Add jira_server.py an method for get users with permission by project (#1682)
1 parent 00ffd96 commit 009e95e

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

‎atlassian/jira/jira_server.py‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,6 +1416,46 @@ def get_users_with_browse_permission_to_a_project(
14161416
Reference: https://docs.atlassian.com/software/jira/docs/api/REST/8.5.0/#api/2/issue
14171417
"""
14181418

1419+
def get_user_with_permission_by_project(
1420+
self,
1421+
permission: str,
1422+
username: str=None,
1423+
issue_key: str=None,
1424+
project_key: str=None,
1425+
start: int=0,
1426+
limit: int=50
1427+
):
1428+
"""
1429+
Returns a list of active users that match the search string. This resource cannot be accessed anonymously
1430+
and requires the Browse Users global permission. Given an issue or project key this resource will provide a list of users
1431+
that match the search string and have the browse issue permission for the provided value.
1432+
1433+
The list of permissions: https://docs.atlassian.com/DAC/javadoc/jira/reference/com/atlassian/jira/security/Permissions.html
1434+
1435+
:param: permission:
1436+
:param: username:
1437+
:param: issueKey:
1438+
:param: projectKey:
1439+
:param: startAt: OPTIONAL
1440+
:param: limit: OPTIONAL
1441+
:return: List of active users who has an permission for the given project_key or issue_key
1442+
"""
1443+
url = self.resource_url("user/permission/search")
1444+
params: dict = {}
1445+
params["permissions"] = permission
1446+
if username:
1447+
params["username"] = username
1448+
if issue_key:
1449+
params["issueKey"] = issue_key
1450+
if project_key:
1451+
params["projectKey"] = project_key
1452+
if start:
1453+
params["startAt"] = start
1454+
if limit:
1455+
params["maxResults"] = limit
1456+
1457+
return self.get(url, params=params)
1458+
14191459
def issue(self, key: T_id, fields: Union[str, dict] = "*all", expand: Optional[str] = None):
14201460
"""Perform the Jira issue operation.
14211461

0 commit comments

Comments
 (0)