Class IdentifiedUser
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCreate an IdentifiedUser, ignoring any per-request state.static classCreate an IdentifiedUser, relying on current request state. -
Field Summary
Fields inherited from class com.google.gerrit.server.CurrentUser
LAST_LOGIN_EXTERNAL_ID_PROPERTY_KEY -
Method Summary
Modifier and TypeMethodDescriptionCast to IdentifiedUser if possible.Returns the account of the identified user.Return account ID ifCurrentUser.isIdentifiedUser()is true.Returns a unique identifier for this user that is intended to be used as a cache key.protected StringgetCommitterName(Account ua, String email) Get the set of groups the user is currently a member of.com.google.common.collect.ImmutableSet<String> Returns all email addresses associated with this user.com.google.common.collect.ImmutableSet<ExternalId.Key> Returns allExternalId.Keys associated with this user.Returns unique name of the user for logging, nevernullgetName()Identity of the authenticated user.Returns the user's user name; null if one has not been selected/assigned or if the user name is empty.booleanhasEmailAddress(String email) booleanhasSameAccountId(CurrentUser other) Checks if the current user has the same account id of another.booleanCheck if user is the IdentifiedUserbooleanReturns a materialized copy of the user with all dependencies.Optional<org.eclipse.jgit.lib.PersonIdent> newCommitterIdent(String email, Instant when, ZoneId zoneId) org.eclipse.jgit.lib.PersonIdentnewCommitterIdent(Instant when, ZoneId zoneId) org.eclipse.jgit.lib.PersonIdentnewCommitterIdent(org.eclipse.jgit.lib.PersonIdent ident) org.eclipse.jgit.lib.PersonIdentorg.eclipse.jgit.lib.PersonIdentnewRefLogIdent(Instant when, ZoneId zoneId) state()Returns the account state of the identified user.toString()Methods inherited from class com.google.gerrit.server.CurrentUser
get, getAccessPath, getLastLoginExternalIdKey, isInternalUser, setAccessPath, updateRealAccountId
-
Method Details
-
getRealUser
Description copied from class:CurrentUserIdentity of the authenticated user.In the normal case where a user authenticates as themselves
getRealUser() == this.If
X-Gerrit-RunAsorsuexecwas used this method returns the identity of the account that has permission to act on behalf of this user.- Overrides:
getRealUserin classCurrentUser
-
isImpersonating
public boolean isImpersonating()- Overrides:
isImpersonatingin classCurrentUser
-
state
Returns the account state of the identified user.- Returns:
- the account state of the identified user, an empty account state if the account is missing
-
asIdentifiedUser
Description copied from class:CurrentUserCast to IdentifiedUser if possible.- Overrides:
asIdentifiedUserin classCurrentUser
-
getAccountId
Description copied from class:CurrentUserReturn account ID ifCurrentUser.isIdentifiedUser()is true.- Overrides:
getAccountIdin classCurrentUser
-
getUserName
Returns the user's user name; null if one has not been selected/assigned or if the user name is empty.- Overrides:
getUserNamein classCurrentUser
-
getLoggableName
Returns unique name of the user for logging, nevernull- Overrides:
getLoggableNamein classCurrentUser
-
getAccount
Returns the account of the identified user.- Returns:
- the account of the identified user, an empty account if the account is missing
-
hasEmailAddress
-
getEmailAddresses
Description copied from class:CurrentUserReturns all email addresses associated with this user. ForAnonymousUserand other users that don't represent a person user or service account, this set will be empty.- Overrides:
getEmailAddressesin classCurrentUser
-
getExternalIdKeys
Description copied from class:CurrentUserReturns allExternalId.Keys associated with this user. ForAnonymousUserand other users that don't represent a person user or service account, this set will be empty.- Overrides:
getExternalIdKeysin classCurrentUser
-
getName
-
getNameEmail
-
getEffectiveGroups
Description copied from class:CurrentUserGet the set of groups the user is currently a member of.The returned set may be a subset of the user's actual groups; if the user's account is currently deemed to be untrusted then the effective group set is only the anonymous and registered user groups. To enable additional groups (and gain their granted permissions) the user must update their account to use only trusted authentication providers.
- Specified by:
getEffectiveGroupsin classCurrentUser- Returns:
- active groups for this user.
-
getCacheKey
Description copied from class:CurrentUserReturns a unique identifier for this user that is intended to be used as a cache key. Returned object should to implementequals()andhashCode()for effective caching.- Specified by:
getCacheKeyin classCurrentUser
-
getRemotePeer
-
newRefLogIdent
public org.eclipse.jgit.lib.PersonIdent newRefLogIdent() -
newRefLogIdent
-
newCommitterIdent
public org.eclipse.jgit.lib.PersonIdent newCommitterIdent(org.eclipse.jgit.lib.PersonIdent ident) -
newCommitterIdent
-
newCommitterIdent
-
toString
-
isIdentifiedUser
public boolean isIdentifiedUser()Check if user is the IdentifiedUser- Overrides:
isIdentifiedUserin classCurrentUser
-
materializedCopy
Returns a materialized copy of the user with all dependencies.Invoke all providers and factories of dependent objects and store the references to a copy of the current identified user.
- Returns:
- copy of the identified user
-
hasSameAccountId
Description copied from class:CurrentUserChecks if the current user has the same account id of another.Provide a generic interface for allowing subclasses to define whether two accounts represent the same account id.
- Overrides:
hasSameAccountIdin classCurrentUser- Parameters:
other- user to compare- Returns:
- true if the two users have the same account id
-
getCommitterName
-