User cannot modify their profile info or picture
Problem
One user cannot update his profile information. In fact, when this user watches their own profile it looks like they are watching the profile of another user.
When the user tries to change their profile picture, the operation fails and the following appears in the atlassian-confluence.log
:
java.lang.IllegalArgumentException: Profile picture belongs to a different user. Needed user: EmbeddedCrowdUser{name='username', displayName='User Name', directoryId=123456} attachment belongs to username
at com.atlassian.confluence.user.DefaultUserAccessor.setUserProfilePicture(DefaultUserAccessor.java:726)
at sun.reflect.GeneratedMethodAccessor12011.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:16)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
...
Diagnosis
Check that the username in the cwd_user
table fully matches the one in the entry for the USERINFO of that particular user in the content
table. Be aware that MySQL may trim spaces at the end of the fields before doing comparisons (i.e., ... where username = 'peter'
will match username 'peter '
).
Cause
This is caused by an extra space at the end of the username
field in the content
table for the entry of the user's USERINFO.
Resolution
Remove the extra spaces from the username for the USERINFO in the
content
table. Remember to take a backup of your database before applying the changes.SELECT CONTENTID FROM CONTENT WHERE USERNAME = '<username>' AND CONTENTTYPE = 'USERINFO'; UPDATE CONTENT SET USERNAME='<username>' WHERE CONTENTID = <content id for the USERINFO>;
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.