Skip to content

Commit

Permalink
[Jira] Add update_permissionscheme method
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktxrrr committed Jan 25, 2025
1 parent 8ac11ad commit f61199e
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions atlassian/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -3764,6 +3764,53 @@ def set_permissionscheme_grant(self, permission_id, new_permission):
url = "{base_url}/{schemeID}/permission".format(base_url=base_url, schemeID=permission_id)
return self.post(url, data=new_permission)

def update_permissionscheme(self, permission_id, name, description=None, permissions=None, scope=None, expand=None):
"""
Updates a permission scheme. Below are some important things to note when using this resource:
- If a permissions list is present in the request, then it is set in the permission scheme, overwriting all existing grants.
- If you want to update only the name and description, then do not send a permissions list in the request.
- Sending an empty list will remove all permission grants from the permission scheme.
Cloud API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-permission-schemes/#api-rest-api-3-permissionscheme-schemeid-put
:param permission_id: int, REQUIRED: The ID of the permission scheme to update.
:param name: str, REQUIRED: The name of the permission scheme. Must be unique.
:param description: str, OPTIONAL: A description for the permission scheme. Defaults to None.
:param permissions: list[dict], OPTIONAL: A collection of permission grants. Defaults to None.
Example:
[
{
"holder": {
"parameter": "jira-core-users",
"type": "group",
"value": "ca85fac0-d974-40ca-a615-7af99c48d24f"
},
"permission": "ADMINISTER_PROJECTS"
}
]
:param scope: OPTIONAL: The scope of the permission scheme.
:param expand: str, OPTIONAL: Use expand to include additional information in the response.
This parameter accepts a comma-separated list.
Note that permissions are always included when you specify any value.
:return:
"""
base_url = self.resource_url("permissionscheme")
url = "{base_url}/{scheme_id}".format(base_url=base_url, scheme_id=permission_id)
data = {"name": name}
if description is not None:
data["description"] = description
if permissions is not None:
data["permissions"] = permissions
if scope is not None:
data["scope"] = scope

params = {}
if expand:
params["expand"] = expand

return self.put(url, data=data, params=params)

"""
REST resource that allows to view security schemes defined in the product.
Resource for managing priority schemes.
Expand Down

0 comments on commit f61199e

Please sign in to comment.