如何更改(更新,编辑)用户权限。例如,在此用户1具有jira-user权限后,注册并创建user1。我需要更新权限,并为user1设置例如jira-administrator。是否有任何对此类做出响应的类,或者我必须在jira DB中更新CWD_USER表。
您可以使用Jira SDK API将用户从一个组转移到另一个组
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.user.util.UserUtil
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.crowd.embedded.api.Group
public void addUserToGroup(String userName, String groupName) {
UserManager userManager = ComponentAccessor.getUserManager();
ApplicationUser user = userManager.getUserByName(userName);
Group group = userManager.getGroup(groupName);
UserUtil userUtil = ComponentAccessor.getUserUtil();
userUtil.addUserToGroup(group, user.getDirectoryUser());
}
由Jira 6.3.10验证