Class GroupBackedUser
This user representation is intended to be used to check permissions for groups:
There are occasions where we need to check if a resource - such as a change - is accessible by
a group. Our entire PermissionBackend
works solely
with CurrentUser
. This class can be used to check permissions on a synthetic user with
the given group memberships. Any real Gerrit user with the same group memberships would receive
the same permission check results.
-
Field Summary
Fields inherited from class com.google.gerrit.server.CurrentUser
LAST_LOGIN_EXTERNAL_ID_PROPERTY_KEY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a unique identifier for this user that is intended to be used as a cache key.Get the set of groups the user is currently a member of.Returns unique name of the user for logging, nevernull
Methods inherited from class com.google.gerrit.server.CurrentUser
asIdentifiedUser, get, getAccessPath, getAccountId, getEmailAddresses, getExternalIdKeys, getLastLoginExternalIdKey, getRealUser, getUserName, hasSameAccountId, isIdentifiedUser, isImpersonating, isInternalUser, setAccessPath, updateRealAccountId
-
Constructor Details
-
GroupBackedUser
Creates a new instance- Parameters:
groups
- this set has to include all parent groups the user is contained in through subgroup membership. Given a set of groups that contains the user directly, callers can useGroupIncludeCache.parentGroupsOf(AccountGroup.UUID)
to resolve parent groups.
-
-
Method Details
-
getEffectiveGroups
Description copied from class:CurrentUser
Get 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:
getEffectiveGroups
in classCurrentUser
- Returns:
- active groups for this user.
-
getLoggableName
Description copied from class:CurrentUser
Returns unique name of the user for logging, nevernull
- Overrides:
getLoggableName
in classCurrentUser
-
getCacheKey
Description copied from class:CurrentUser
Returns 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:
getCacheKey
in classCurrentUser
-