Hi,
is it possible to delete your own/some one else 's (as admin) profile picture in confluence 5.8?
If it's not possible via the ui, can it be done from java api?
Best regards, Lukas
Community moderators have prevented the ability to post new answers.
Java class
public class RemoveProfilePicture extends HttpServlet { private String user; private UserAccessor userAccessor; @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { //only make it usable by administrators if (userAccessor.hasMembership(userAccessor.getGroup("confluence-administrators"), AuthenticatedUserThreadLocal.get())) { user = request.getParameter("user"); ConfluenceUser confUser = userAccessor.getUserByName(user); if (confUser != null) { userAccessor.getPropertySet(confUser).remove(UserPreferencesKeys.PROPERTY_USER_PROFILE_PICTURE); response.getWriter().append("Profile pic removed for user: " + user); } else response.getWriter().append("No such user: " + user); } else response.getWriter().append("No permission"); } public void setUserAccessor(UserAccessor userAccessor) { this.userAccessor = userAccessor; } public void setUser(String user) { this.user = user; } }
Add this to atlassian-plugin.xml
<servlet key="remove-pic-servlet" class="com.tieto.plugins.utilities.RemoveProfilePicture" name="Remove profile pic servlet"> <url-pattern>/custom/removeProfilePicture</url-pattern> </servlet>
Of course, replace class with your class name. You can also change url pattern if you wish.
Access it with this url: /plugins/servlet/custom/removeProfilePicture?user=username , where username is actual username.
Thanks a lot, just what i was looking for. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes i am. Could you send me some sample code? That would be great.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can write a servlet plugin which would do that. Are you familiar with writing plugins in confluence?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.