Search in sources :

Example 1 with CapabilityControl

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);
}
Also used : ProvisionException(com.google.inject.ProvisionException) CapabilityControl(com.google.gerrit.server.account.CapabilityControl) SocketAddress(java.net.SocketAddress) InetSocketAddress(java.net.InetSocketAddress) OutOfScopeException(com.google.inject.OutOfScopeException) Provider(com.google.inject.Provider)

Aggregations

CapabilityControl (com.google.gerrit.server.account.CapabilityControl)1 OutOfScopeException (com.google.inject.OutOfScopeException)1 Provider (com.google.inject.Provider)1 ProvisionException (com.google.inject.ProvisionException)1 InetSocketAddress (java.net.InetSocketAddress)1 SocketAddress (java.net.SocketAddress)1