Hi team,
Upon a user leaving the organization, their access to JIRA and Confluence is revoked through SCIM, but the permission groups they were added to remain intact. We are manually removing users from permission groups upon deactivation. Can we automate this process to remove users from other permission groups when they are deactivated?
Regards:
Pavan.
Hi Pavan,
You should be able to write a script which:
With this REST API you can delete the user from a group, but if you use Python you can use the atlassian library and create a script like:
from atlassian import Jira
# Jira API credentials and base URL
USERNAME = 'your_username'
PASSWORD = 'your_api_token'
JIRA_URL = 'https://your_jira_instance_url.atlassian.net'
# Function to fetch user groups
def get_user_groups(username):
jira = Jira(url=JIRA_URL, username=USERNAME, password=PASSWORD)
groups = jira.user_groups(username)
return groups
# Function to remove user from groups
def remove_user_from_groups(username, groups):
jira = Jira(url=JIRA_URL, username=USERNAME, password=PASSWORD)
for group in groups:
jira.remove_user_from_group(group, username)
print(f"User {username} removed from group: {group}")
# Main function
def main():
# Input username
username = input("Enter the username: ")
# Fetch user groups
user_groups = get_user_groups(username)
if user_groups:
print(f"User {username} belongs to the following groups: {', '.join(user_groups)}")
# Remove user from groups
remove_user_from_groups(username, user_groups)
if __name__ == "__main__":
main()
Good luck
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.