mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00

1. Remove _organizationService.ValidateOrganizationUserUpdatePermissions since it is not needed for updating group associations. 2. Remove loggedInUserId since it's no longer needed. 3. Update/remove related tests.
28 lines
1.0 KiB
C#
28 lines
1.0 KiB
C#
using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.Interfaces;
|
|
using Bit.Core.Entities;
|
|
using Bit.Core.Enums;
|
|
using Bit.Core.Repositories;
|
|
using Bit.Core.Services;
|
|
|
|
namespace Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers;
|
|
|
|
public class UpdateOrganizationUserGroupsCommand : IUpdateOrganizationUserGroupsCommand
|
|
{
|
|
private readonly IEventService _eventService;
|
|
private readonly IOrganizationUserRepository _organizationUserRepository;
|
|
|
|
public UpdateOrganizationUserGroupsCommand(
|
|
IEventService eventService,
|
|
IOrganizationUserRepository organizationUserRepository)
|
|
{
|
|
_eventService = eventService;
|
|
_organizationUserRepository = organizationUserRepository;
|
|
}
|
|
|
|
public async Task UpdateUserGroupsAsync(OrganizationUser organizationUser, IEnumerable<Guid> groupIds)
|
|
{
|
|
await _organizationUserRepository.UpdateGroupsAsync(organizationUser.Id, groupIds);
|
|
await _eventService.LogOrganizationUserEventAsync(organizationUser, EventType.OrganizationUser_UpdatedGroups);
|
|
}
|
|
}
|