mirror of
https://github.com/bitwarden/server.git
synced 2024-11-24 12:35:25 +01:00
Removed AcceptOrgUserByOrgId and replaced with existing method.
This commit is contained in:
parent
974d23efdd
commit
170f2ea656
@ -347,7 +347,7 @@ public class OrganizationUsersController : Controller
|
||||
var orgUser = await _organizationUserRepository.GetByOrganizationAsync(orgId, user.Id);
|
||||
if (orgUser.Status == OrganizationUserStatusType.Invited)
|
||||
{
|
||||
await _acceptOrgUserCommand.AcceptOrgUserByOrgIdAsync(orgId, user, _userService);
|
||||
await _acceptOrgUserCommand.AcceptOrgUserAsync(orgUser, user, _userService);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,13 +103,6 @@ public class AcceptOrgUserCommand : IAcceptOrgUserCommand
|
||||
return organizationUser;
|
||||
}
|
||||
|
||||
private bool ValidateOrgUserInviteToken(string orgUserInviteToken, OrganizationUser orgUser)
|
||||
{
|
||||
return _orgUserInviteTokenDataFactory.TryUnprotect(orgUserInviteToken, out var decryptedToken)
|
||||
&& decryptedToken.Valid
|
||||
&& decryptedToken.TokenIsValid(orgUser);
|
||||
}
|
||||
|
||||
public async Task<OrganizationUser> AcceptOrgUserByOrgSsoIdAsync(string orgSsoIdentifier, User user, IUserService userService)
|
||||
{
|
||||
var org = await _organizationRepository.GetByIdentifierAsync(orgSsoIdentifier);
|
||||
@ -127,23 +120,6 @@ public class AcceptOrgUserCommand : IAcceptOrgUserCommand
|
||||
return await AcceptOrgUserAsync(orgUser, user, userService);
|
||||
}
|
||||
|
||||
public async Task<OrganizationUser> AcceptOrgUserByOrgIdAsync(Guid organizationId, User user, IUserService userService)
|
||||
{
|
||||
var org = await _organizationRepository.GetByIdAsync(organizationId);
|
||||
if (org == null)
|
||||
{
|
||||
throw new BadRequestException("Organization invalid.");
|
||||
}
|
||||
|
||||
var orgUser = await _organizationUserRepository.GetByOrganizationAsync(org.Id, user.Id);
|
||||
if (orgUser == null)
|
||||
{
|
||||
throw new BadRequestException("User not found within organization.");
|
||||
}
|
||||
|
||||
return await AcceptOrgUserAsync(orgUser, user, userService);
|
||||
}
|
||||
|
||||
public async Task<OrganizationUser> AcceptOrgUserAsync(OrganizationUser orgUser, User user,
|
||||
IUserService userService)
|
||||
{
|
||||
|
@ -13,6 +13,5 @@ public interface IAcceptOrgUserCommand
|
||||
/// <returns>The accepted OrganizationUser.</returns>
|
||||
Task<OrganizationUser> AcceptOrgUserByEmailTokenAsync(Guid organizationUserId, User user, string emailToken, IUserService userService);
|
||||
Task<OrganizationUser> AcceptOrgUserByOrgSsoIdAsync(string orgIdentifier, User user, IUserService userService);
|
||||
Task<OrganizationUser> AcceptOrgUserByOrgIdAsync(Guid organizationId, User user, IUserService userService);
|
||||
Task<OrganizationUser> AcceptOrgUserAsync(OrganizationUser orgUser, User user, IUserService userService);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user