I cannot get the userManager.createUser(...)
to work with Confluence 9.0-m132.
Somehow I cannot import and use DefaultUser anymore.
<Import-Package>
com.atlassian.sal.*,
com.atlassian.user.impl.*,<!-- needed for usermanager.createuser -->
</Import-Package>
Now I get
Caused by: org.osgi.framework.BundleException: Unable to resolve io.codeclou.app-confluence-common [298](R 298.0):
missing requirement [io.foo.app-confluence-common [298](R 298.0)]
osgi.wiring.package; (osgi.wiring.package=com.atlassian.user.impl)
Unresolved requirements: [[io.foo.app-confluence-common [298](R 298.0)]
osgi.wiring.package; (osgi.wiring.package=com.atlassian.user.impl)]
Second is UserPreferencesAccessor and UserAccessor gets OSGI errors when trying to use it
1. org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType= UserPreferencesAccessor,parent=UsersEndpoint,qualifiers={},position=1,optional=false,self=false,unqualified=null,1108564563)
2. java.lang.IllegalArgumentException: While attempting to resolve the dependencies of io.foo.app.confluence.common.rest.UsersEndpoint errors were found
3. java.lang.IllegalStateException: Unable to perform operation: resolve on io.foo.app.confluence.common.rest.UsersEndpoint
I do with Spring Java Config
@Bean
public UserPreferencesAccessor initUserPreferencesAccessor() {
return importOsgiService(UserPreferencesAccessor);
}
UPDATE 2024-07-01: With Confluence 9.0-beta2 the app starts again and can access the UserAccessor. BUT it is marked as deprecated => What is the right Class to use to get/set UserPreferences then? I use currently:
User foundUser = userManager.getUser(userName);
ConfluenceUserPreferences prefs = userAccessor.getConfluenceUserPreferences(foundUser);
prefs.setString(UserPreferencesKeys.PROPERTY_USER_LOCALE, localePayload.getLocale());
UPDATE 2024-07-02: Using UserPreferencesAccessor instead of UserAccessor works with Confluence 9.0-beta2. No deprecation warnings anymore.