mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[AC-2602] Fix error when provider edits existing group (#4086)
* Add null check to groups endpoint - providers may not be OrgUsers
This commit is contained in:
@ -200,7 +200,8 @@ public class GroupsController : Controller
|
||||
var userId = _userService.GetProperUserId(User).Value;
|
||||
var organizationUser = await _organizationUserRepository.GetByOrganizationAsync(orgId, userId);
|
||||
var currentGroupUsers = await _groupRepository.GetManyUserIdsByIdAsync(id);
|
||||
if (!currentGroupUsers.Contains(organizationUser.Id) && model.Users.Contains(organizationUser.Id))
|
||||
// OrganizationUser may be null if the current user is a provider
|
||||
if (organizationUser != null && !currentGroupUsers.Contains(organizationUser.Id) && model.Users.Contains(organizationUser.Id))
|
||||
{
|
||||
throw new BadRequestException("You cannot add yourself to groups.");
|
||||
}
|
||||
|
Reference in New Issue
Block a user