Package com.google.gerrit.entities
Class Account
java.lang.Object
com.google.gerrit.entities.Account
Information about a single user.
A user may have multiple identities they can use to login to Gerrit (see ExternalId), but in such cases they always map back to a single Account entity.
Entities "owned" by an Account (that is, their primary key contains the Account.Id
key
as part of their key structure):
- ExternalId: OpenID identities and email addresses known to be registered to this user. Multiple records can exist when the user has more than one public identity, such as a work and a personal email address.
- AccountSshKey: user's public SSH keys, for authentication through the internal SSH daemon. One record per SSH key uploaded by the user, keys are checked in random order until a match is found.
DiffPreferencesInfo
: user's preferences for rendering side-to-side and unified diff
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
Key local to Gerrit to identify a user. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Account.Id
Placeholder for indicating an account-id that does not correspond to any local account -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Account.Builder
builder
(Account.Id newId, Instant registeredOn) Create a new account.abstract String
Optional display name of the user to be shown in the UI.abstract String
fullName()
Full name of the user ("Given-name Surname" style).getName()
Formats an account name.static String
getName
(Account.Id accountId) getNameEmail
(String anonymousCowardName) Get the name and email address.abstract Account.Id
id()
static Account.Id
id
(int id) abstract boolean
inactive()
Is this user inactive? This is used to avoid showing some users (eg.boolean
isActive()
abstract String
metaId()
ID of the user branch from which the account was read.abstract String
Email address the user prefers to be contacted through.abstract Instant
Date and time the user registered with the review server.abstract String
status()
The user-settable status of this account (e.g.abstract Account.Builder
final String
toString()
-
Field Details
-
UNKNOWN_ACCOUNT_ID
Placeholder for indicating an account-id that does not correspond to any local account
-
-
Constructor Details
-
Account
public Account()
-
-
Method Details
-
id
-
id
-
registeredOn
Date and time the user registered with the review server. -
fullName
Full name of the user ("Given-name Surname" style). -
displayName
Optional display name of the user to be shown in the UI. -
preferredEmail
Email address the user prefers to be contacted through. -
inactive
public abstract boolean inactive()Is this user inactive? This is used to avoid showing some users (eg. former employees) in auto-suggest. -
status
The user-settable status of this account (e.g. busy, OOO, available) -
metaId
ID of the user branch from which the account was read. -
builder
Create a new account.- Parameters:
newId
- unique id, see Sequences#nextAccountId().registeredOn
- when the account was registered.
-
getName
Formats an account name.The return value goes into NoteDb commits and audit logs, so it should not be changed.
This method deliberately does not use
Anonymous Coward
because it can be changed using agerrit.config
option which is a problem for NoteDb commits that still refer to a previously defined value.- Returns:
- the fullname, if present, otherwise the preferred email, if present, as a last resort a generic string containing the accountId.
-
getName
-
getNameEmail
Get the name and email address.Example output:
A U. Thor <[email protected]>
: full populatedA U. Thor (12)
: missing email addressAnonymous Coward <[email protected]>
: missing nameAnonymous Coward (12)
: missing name and email address
-
isActive
public boolean isActive() -
toBuilder
-
toString
-