Document missing artifact dependency for UserStoragePrivateUtil

Closes #43212

Signed-off-by: Martin Kanis <mkanis@redhat.com>
Co-authored-by: Martin Kanis <mkanis@redhat.com>
This commit is contained in:
Pedro Igor 2025-11-11 09:46:51 -03:00 committed by GitHub
parent 0a05348ab6
commit 8aada2c8e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,9 +30,10 @@ begin first by modifying the `createAdapter()` method.
[source,java]
----
protected UserModel createAdapter(RealmModel realm, String username) {
UserModel local = UserStoragePrivateUtil.userLocalStorage(session).getUserByUsername(realm, username);
UserProvider userProvider = session.getProvider(UserProvider.class);
UserModel local = userProvider.getUserByUsername(realm, username);
if (local == null) {
local = UserStoragePrivateUtil.userLocalStorage(session).addUser(realm, username);
local = userProvider.addUser(realm, username);
local.setFederationLink(model.getId());
}
return new UserModelDelegate(local) {
@ -49,7 +50,7 @@ begin first by modifying the `createAdapter()` method.
}
----
In this method we call the `UserStoragePrivateUtil.userLocalStorage(session)` method to obtain a reference to local {project_name}
In this method we call `session.getProvider(UserProvider.class)` to obtain a reference to local {project_name}
user storage. We see if the user is stored locally, if not, we add it locally. Do not set the `id` of the local user.
Let {project_name} automatically generate the `id`. Also note that we call
`UserModel.setFederationLink()` and pass in the ID of the `ComponentModel` of our provider. This sets a link between