Skip to content

Commit 2eb9d53

Browse files
committed
Added new Jira 8 experimental module.
Added Jira 8 docs template.
1 parent 540d269 commit 2eb9d53

File tree

3 files changed

+100
-1
lines changed

3 files changed

+100
-1
lines changed

atlassian/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,16 @@
77
from .crowd import Crowd
88
from .service_desk import ServiceDesk
99
from .marketplace import MarketPlace
10+
from .jira8 import Jira8
1011

11-
__all__ = ['Confluence', 'Jira', 'Bitbucket', 'Portfolio', 'Bamboo', 'Stash', 'Crowd', 'ServiceDesk', 'MarketPlace']
12+
__all__ = [
13+
'Confluence',
14+
'Jira',
15+
'Bitbucket',
16+
'Portfolio',
17+
'Bamboo',
18+
'Stash',
19+
'Crowd',
20+
'ServiceDesk',
21+
'MarketPlace'
22+
]

atlassian/jira8.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# coding: utf-8
2+
import logging
3+
from .rest_client import AtlassianRestAPI
4+
5+
log = logging.getLogger(__name__)
6+
7+
8+
class Jira8(AtlassianRestAPI):
9+
10+
# API/2 Get permissions
11+
def get_permissions(self, project_id=None, project_key=None, issue_id=None, issue_key=None):
12+
"""
13+
Returns all permissions in the system and whether the currently logged in user has them.
14+
You can optionally provide a specific context
15+
to get permissions for (projectKey OR projectId OR issueKey OR issueId)
16+
17+
:param project_id: str
18+
:param project_key: str
19+
:param issue_id: str
20+
:param issue_key: str
21+
:return:
22+
"""
23+
url = 'rest/api/2/mypermissions'
24+
params = {}
25+
26+
if project_id:
27+
params['projectId'] = project_id
28+
if project_key:
29+
params['projectKey'] = project_key
30+
if issue_id:
31+
params['issueId'] = issue_id
32+
if issue_key:
33+
params['issueKey'] = issue_key
34+
35+
return self.get(url, params=params)
36+
37+
def get_all_permissions(self):
38+
"""
39+
Returns all permissions that are present in the JIRA instance - Global, Project
40+
and the global ones added by plugins
41+
42+
:return: All permissions
43+
"""
44+
url = 'rest/api/2/permissions'
45+
46+
return self.get(url)
47+
48+
# Application properties
49+
def get_property(self, key=None, permission_level=None, key_filter=None):
50+
"""
51+
Returns an application property
52+
53+
:param key: str
54+
:param permission_level: str
55+
:param key_filter: str
56+
:return: list or item
57+
"""
58+
url = 'rest/api/2/application-properties'
59+
params = {}
60+
61+
if key:
62+
params['key'] = key
63+
if permission_level:
64+
params['permissionLevel'] = permission_level
65+
if key_filter:
66+
params['keyFilter'] = key_filter
67+
68+
return self.get(url, params=params)
69+
70+
def set_property(self, property_id, value):
71+
url = 'rest/api/2/application-properties/{}'.format(property_id)
72+
data = {'id': property_id, 'value': value}
73+
74+
return self.put(url, data=data)
75+
76+
def get_advanced_settings(self):
77+
"""
78+
Returns the properties that are displayed on the "General Configuration > Advanced Settings" page
79+
80+
:return:
81+
"""
82+
url = 'rest/api/2/application-properties/advanced-settings'
83+
84+
return self.get(url)

docs/jira8.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Jira 8 module
2+
=============
3+
4+
This is the test module.

0 commit comments

Comments
 (0)