public class Groups extends Object
All calls which read group related details from the database are gathered here. Other classes
should always use this class instead of accessing the database directly. There are a few
exceptions though: schema classes, wrapper classes, and classes executed during init. The latter
ones should use GroupsOnInit
instead.
Most callers should not need to read groups directly from the database; they should use the
GroupCache
instead.
If not explicitly stated, all methods of this class refer to internal groups.
Constructor and Description |
---|
Groups(GitRepositoryManager repoManager,
AllUsersName allUsersName,
AuditLogReader auditLogReader) |
Modifier and Type | Method and Description |
---|---|
Stream<GroupReference> |
getAllGroupReferences()
Returns
GroupReference s for all internal groups. |
Stream<AccountGroup.UUID> |
getExternalGroups()
Returns all known external groups.
|
Optional<InternalGroup> |
getGroup(AccountGroup.UUID groupUuid)
Returns the
InternalGroup for the specified UUID if it exists. |
List<AccountGroupMemberAudit> |
getMembersAudit(org.eclipse.jgit.lib.Repository allUsersRepo,
AccountGroup.UUID groupUuid)
Returns the membership audit records for a given group.
|
List<AccountGroupByIdAud> |
getSubgroupsAudit(org.eclipse.jgit.lib.Repository repo,
AccountGroup.UUID groupUuid)
Returns the subgroup audit records for a given group.
|
@Inject public Groups(GitRepositoryManager repoManager, AllUsersName allUsersName, AuditLogReader auditLogReader)
public Optional<InternalGroup> getGroup(AccountGroup.UUID groupUuid) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
InternalGroup
for the specified UUID if it exists.groupUuid
- the UUID of the groupInternalGroup
if it exists, or else an empty Optional
IOException
- if the group couldn't be retrieved from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the group couldn't be retrieved from NoteDbpublic Stream<GroupReference> getAllGroupReferences() throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
GroupReference
s for all internal groups.GroupReference
s of all internal groupsIOException
- if an error occurs while reading from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the data in NoteDb is in an incorrect formatpublic Stream<AccountGroup.UUID> getExternalGroups() throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
IOException
- if an error occurs while reading from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the data in NoteDb is in an incorrect formatpublic List<AccountGroupMemberAudit> getMembersAudit(org.eclipse.jgit.lib.Repository allUsersRepo, AccountGroup.UUID groupUuid) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
allUsersRepo
- All-Users repository.groupUuid
- the UUID of the groupIOException
- if an error occurs while reading from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the group couldn't be retrieved from NoteDbpublic List<AccountGroupByIdAud> getSubgroupsAudit(org.eclipse.jgit.lib.Repository repo, AccountGroup.UUID groupUuid) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
repo
- All-Users repository.groupUuid
- the UUID of the groupIOException
- if an error occurs while reading from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the group couldn't be retrieved from NoteDb