This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import os | |
import csv | |
# Confluence credentials and domain | |
JIRA_DOMAIN = "https://your_domain.atlassian.net" | |
EMAIL = os.getenv("JIRA_EMAIL", "EMAIL_ADDRESS") | |
API_TOKEN = os.getenv("JIRA_API_TOKEN", "API_TOKEN") | |
# Headers for authentication |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import csv | |
# Constants | |
ORG_ID = "YOUR_ORG_ID" | |
BASE_URL = f"https://api.atlassian.com/admin/v1/orgs/{ORG_ID}/users" | |
BEARER_TOKEN = "your_bearer_token_here" # Replace with your actual token | |
HEADERS = { | |
"Authorization": f"Bearer {BEARER_TOKEN}", | |
"Accept": "application/json" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fieldsResponse = get('/rest/api/2/field').asObject(List).body | |
def fieldCounts = [:] | |
fieldsResponse.each { field -> | |
def fieldId = field.id | |
def fieldName = field.name | |
def fieldType = field.schema?.type ?: 'N/A' | |
def jqlQuery | |
if (fieldId.startsWith('customfield_')) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Retrieve the list of projects | |
def projectsResponse = get('/rest/api/2/project').asObject(List).body | |
def fieldMappings = [:] | |
projectsResponse.each { project -> | |
def projectId = project.id | |
def projectName = project.name | |
// Retrieve the list of screens for the project |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Base64 | |
// Replace these with your Jira username and API token (or password) | |
def username = "YOUR_USERNAME" | |
def token = "YOUR_API_TOKEN" | |
// Encode the username and token in Base64 | |
def credentials = "${username}:${token}".bytes.encodeBase64().toString() | |
// Define headers with Basic Authentication |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def results = get("https://api.restful-api.dev/objects") | |
.asObject(List) | |
.body as List<Map> | |
def objectDetails = results.collect { "${it.id}: ${it.name}" } | |
return objectDetails |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.adaptavist.hapi.jira.issues.Issues | |
import com.onresolve.jira.groovy.user.FieldBehaviours | |
import groovy.transform.BaseScript | |
@BaseScript FieldBehaviours behaviours | |
def linkedIssues = getFieldById('issuelinks-issues') | |
def linkedIssuesValue = linkedIssues.value as List<String> | |
linkedIssues.clearError() | |
linkedIssuesValue.each { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate | |
import groovy.json.JsonBuilder | |
import groovy.json.JsonOutput | |
import groovy.transform.BaseScript | |
import groovyx.net.http.ContentType | |
import groovyx.net.http.HTTPBuilder | |
import groovyx.net.http.Method | |
import javax.ws.rs.core.MultivaluedMap | |
import javax.ws.rs.core.Response |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() | |
return ComponentAccessor.getGroupManager().isUserInGroup(currentUser,"jira-admin") || ComponentAccessor.getGroupManager().isUserInGroup(currentUser,"jira-users") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT p.pkey as "Project key", pr.name as "Role name", u.lower_user_name as "Username", u.display_name as "Display name", u.lower_email_address as "e-Mail", null as "Group name" | |
FROM projectroleactor pra | |
INNER JOIN projectrole pr ON pr.ID = pra.PROJECTROLEID | |
INNER JOIN project p ON p.ID = pra.PID | |
INNER JOIN app_user au ON au.user_key = pra.ROLETYPEPARAMETER | |
INNER JOIN cwd_user u ON u.lower_user_name = au.lower_user_name | |
WHERE pra.roletype = 'atlassian-user-role-actor' | |
AND p.pkey = 'VYT' | |
UNION | |
SELECT p.pkey as "Project key", pr.name as "Role name", cmem.lower_child_name as "Username", u.display_name as "Display name", u.lower_email_address as "e-Mail", cmem.lower_parent_name as "Group name" |
NewerOlder