Class DefaultPermissionBackend

    • Method Detail

      • user

        public PermissionBackend.WithUser user​(CurrentUser user)
        Description copied from class: PermissionBackend
        Returns an instance scoped to the specified user. Should be used in cases where the user could either be the issuer of the current request or an impersonated user. PermissionBackends that do not support impersonation can fail with an IllegalStateException.

        If an instance scoped to the current user is desired, use currentUser() instead.

        Specified by:
        user in class PermissionBackend
      • absentUser

        public PermissionBackend.WithUser absentUser​(Account.Id id)
        Description copied from class: PermissionBackend
        Returns an instance scoped to the provided user. Should be used in cases where the caller wants to check the permissions of a user who is not the issuer of the current request and not the target of impersonation.

        Usage should be very limited as this can expose a group-oracle.

        Specified by:
        absentUser in class PermissionBackend
      • usesDefaultCapabilities

        public boolean usesDefaultCapabilities()
        Description copied from class: PermissionBackend
        Check whether this PermissionBackend respects the same global capabilities as the DefaultPermissionBackend.

        If true, then it makes sense for downstream callers to refer to built-in Gerrit capability names in user-facing error messages, for example.

        Overrides:
        usesDefaultCapabilities in class PermissionBackend
        Returns:
        whether this is the default permission backend.