1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-06 10:32:49 -05:00

[PM-16812] Shortcut duplicate group patch requests (#5354)

* Copy PatchGroupCommand to vNext and refactor

* Detect duplicate add requests and return early

* Update read repository method to use HA replica

* Add new write repository method
This commit is contained in:
Thomas Rittson
2025-02-14 11:09:01 +10:00
committed by GitHub
parent ac6bc40d85
commit 54d59b3b92
21 changed files with 1437 additions and 250 deletions

View File

@ -14,11 +14,29 @@ public interface IGroupRepository : IRepository<Group, Guid>
Guid organizationId);
Task<ICollection<Group>> GetManyByManyIds(IEnumerable<Guid> groupIds);
Task<ICollection<Guid>> GetManyIdsByUserIdAsync(Guid organizationUserId);
Task<ICollection<Guid>> GetManyUserIdsByIdAsync(Guid id);
/// <summary>
/// Query all OrganizationUserIds who are a member of the specified group.
/// </summary>
/// <param name="id">The group id.</param>
/// <param name="useReadOnlyReplica">
/// Whether to use the high-availability database replica. This is for paths with high traffic where immediate data
/// consistency is not required. You generally do not want this.
/// </param>
/// <returns></returns>
Task<ICollection<Guid>> GetManyUserIdsByIdAsync(Guid id, bool useReadOnlyReplica = false);
Task<ICollection<GroupUser>> GetManyGroupUsersByOrganizationIdAsync(Guid organizationId);
Task CreateAsync(Group obj, IEnumerable<CollectionAccessSelection> collections);
Task ReplaceAsync(Group obj, IEnumerable<CollectionAccessSelection> collections);
Task DeleteUserAsync(Guid groupId, Guid organizationUserId);
/// <summary>
/// Update a group's members. Replaces all members currently in the group.
/// Ignores members that do not belong to the same organization as the group.
/// </summary>
Task UpdateUsersAsync(Guid groupId, IEnumerable<Guid> organizationUserIds);
/// <summary>
/// Add members to a group. Gracefully ignores members that are already in the group,
/// duplicate organizationUserIds, and organizationUsers who are not part of the organization.
/// </summary>
Task AddGroupUsersByIdAsync(Guid groupId, IEnumerable<Guid> organizationUserIds);
Task DeleteManyAsync(IEnumerable<Guid> groupIds);
}