So I'm trying to upload profile pictures for our Active Directory. I was able to accomplish this in Jira, but I'm having some issues with setting the picture in Confluence (getting the picture isn't a problem).
I've been trying to use the
void setUserProfilePicture(com.atlassian.user.User targetUser, String imagePath)
That is documented here: https://docs.atlassian.com/ConfluenceServer/javadoc/7.2.1/index.html?index-all.html
I'm thinking I'm having a problem with this sentence: The path should be the web-application-root-relative path to the image to be used as the user's profile picture
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.user.UserAccessor
def userAccessor = ComponentLocator.getComponent(UserAccessor)
confUser = userAccessor.getUserByName("boisvers")
userAccessor.setUserProfilePicture(confUser, "/data/atlassian/application-data/confluence/scripts/data/Oscar.jpg")
I did notice that if I manually upload my profile picture, then run the script. The manual profile pic is removed and replaced with the silhouette avatar.
Well I figured this out.... lol
Been working on this for two days now and 35 minutes after posting I figured it out.
Profile pics need to be under the images directory (preferable images/icons/profilepics).
Then use "/images/icons/profilepics/test.png" in the setUserProfilePicture....
userAccessor.setUserProfilePicture(confUser, "/images/icons/profilepics/test.png")
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.