Hi guys,
I'm searching for a solution that gives me the opportunity to add users with a certain e-mail adress to an additional group.
At the moment every logged in user is added to an internal confluence group. Some users with a specific e-mail "@abc.de" should be added to an additional group.
The only option i found at the moment would be a groovy script which would do that after the user is created. Or is there an easier way to do that?
I checked all groovy scripts for confluence i could and tried to add them to my needs. Actually it would only need a check for all users with the defined email adress.
import com.atlassian.confluence.user.UserAccessor
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.user.GroupManager
import com.atlassian.user.UserManager
def groupManager = ComponentLocator.getComponent(GroupManager)
def userAccessor = ComponentLocator.getComponent(UserAccessor)
def specialGroup = groupManager.getGroup("special") ?: groupManager.createGroup("special")
def users = userManager.users
def usersToMove = ["anuser", "u100"]
usersToMove.each { username ->
def user = userAccessor.getUserByName(username)
if (user) {
log.info "Add user ${user.name} to the group: 'Special Group'"
groupManager.addMembership(specialGroup, user)
}