用scriptrunner插件写脚本,创建上万条Jira用户
import com.atlassian.crowd.embedded.api.Group
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.groups.GroupManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.UserDetails
import org.apache.commons.lang3.RandomStringUtils
def createUser = {
int num ->
for (int i = 0; i < num; i++) {
String random = RandomStringUtils.randomAlphabetic(5);
String emailAddress = random + "@shdsd-test.com";
UserDetails userDetail = new UserDetails(random, random).withDirectory(1L).withPassword(random).withEmail(emailAddress);
ApplicationUser user = ComponentAccessor.getUserManager().createUser(userDetail);
GroupManager groupManager = ComponentAccessor.getGroupManager();
Group group = groupManager.getGroup("jira-administrators");
groupManager.addUserToGroup(user, group);
}
}
createUser(1)
posted on 2021-02-07 10:00 Sunshine-jcy 阅读(201) 评论(0) 编辑 收藏 举报