use of com.google.gerrit.server.account.CapabilityControl in project gerrit by GerritCodeReview.
the class IdentifiedUser method materializedCopy.
/**
* Returns a materialized copy of the user with all dependencies.
*
* <p>Invoke all providers and factories of dependent objects and store the references to a copy
* of the current identified user.
*
* @return copy of the identified user
*/
public IdentifiedUser materializedCopy() {
CapabilityControl capabilities = getCapabilities();
Provider<SocketAddress> remotePeer;
try {
remotePeer = Providers.of(remotePeerProvider.get());
} catch (OutOfScopeException | ProvisionException e) {
remotePeer = new Provider<SocketAddress>() {
@Override
public SocketAddress get() {
throw e;
}
};
}
return new IdentifiedUser(new CapabilityControl.Factory() {
@Override
public CapabilityControl create(CurrentUser user) {
return capabilities;
}
}, authConfig, realm, anonymousCowardName, Providers.of(canonicalUrl.get()), accountCache, groupBackend, disableReverseDnsLookup, remotePeer, state, realUser);
}
Aggregations