Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I want a script that will deactivate the users that have not logged in since 90 days.Version 8.4.3

tanvi_dhawanpatil
May 5, 2020

It should provide me the list of the users that have not logged from 90days

2 answers

Suggest an answer

Log in or Sign up to answer
1 vote
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
May 16, 2022

I think you can pretty much copy and paste the script over at https://library.adaptavist.com/entity/remove-specified-users-from-a-group - swapping the line at the end from removeUserFromGroup to addUserToGroup

0 votes
Ravi Sagar _Sparxsys_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
May 16, 2022

Hi @David Lee 

You would need to use group manager to do that. It is very simple script.

ComponentAccessor.groupManager.addUserToGroup(userToAdd, groupName)

I made a video and shared the script with some error handling in one of my video here.

Thanks,

Ravi

David Lee
May 16, 2022

Thanks @Ravi Sagar _Sparxsys_ for the information, I am able to add single groups without error with this script.

 

What would I need to do to this to add in another group? Or do I just need to run it multiple times, changing the "group1" each time?
import com.atlassian.jira.component.ComponentAccessor
def userName = "User"
def groupNametoAdd = "group1"
def userToAdd = ComponentAccessor.getUserManager().getUserByName(userName)
def groupName = ComponentAccessor.getGroupManager().getGroup(groupNametoAdd)

ComponentAccessor.groupManager.addUserToGroup(userToAdd, groupName)
TAGS
AUG Leaders

Atlassian Community Events