コード例 #1
0
def main():
    i = 0
    jira = JIRA("http://localhost:8080", basic_auth=('pro', 'pro'))

    projects = jira.projects()

    for project in projects:
        print("Project Name: " + project.name)
        roles = jira.project_roles(project)

        for role in roles:
            print("Role Name: " + role)

            the_role = jira.project_role(project, role)
            for actor in role.actors:
                print("Actor Name: " + actor)

    sys.exit(42)

    my_array = []

    for group in groups:
        j = 0
        my_array.append([group])
        print("Group Name: " + group)
        j = j + 1
        members = jira.group_members(group)

        for member in members:
            my_array[i].append(member)
            print("     Member: " + member)
            j = j + 1
        i = i + 1

    pickle.dump(my_array, open("groupBackup.p", "wb"))
コード例 #2
0
project = os.environ['JIRA_PROJECT']
username = os.environ['JIRA_USERNAME']
password = os.environ['JIRA_PASSWORD']

#   connect to Jira
options = {"server": server}
jira = JIRA(options, basic_auth=(username, password))

#   get all the roles in the project
roles = jira.project_roles(project)
print(f"project = {project}")

#   for each role, get the role name
for rolename in roles:
    roleid = roles[rolename]['id']
    role = jira.project_role(project, roleid)
    roledescription = role.description or "<role description missing>"
    print(f"   role = {rolename} ({roleid}, {roledescription})")

    #   then look in that role's members, either groups or users or both
    for actor in role.actors:
        actorid = actor.id
        actorname = actor.name
        actordisplayname = actor.displayName
        actortype = actor.type
        actortype_display = "UNKNOWN"

        #   if it's a user, then print the user's data
        if (actortype == "atlassian-user-role-actor"):
            actortype_display = "USER"
            print(