1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-27 17:47:37 +01:00

org re-invite api

This commit is contained in:
Kyle Spearrin 2019-10-07 16:23:38 -04:00
parent 19b8c385d2
commit 72750cf298
3 changed files with 24 additions and 2 deletions

View File

@ -203,5 +203,27 @@ namespace Bit.Api.Public.Controllers
await _organizationService.DeleteUserAsync(_currentContext.OrganizationId.Value, id, null);
return new OkResult();
}
/// <summary>
/// Re-invite a member.
/// </summary>
/// <remarks>
/// Re-sends the invitation email to an organization member.
/// </remarks>
/// <param name="id">The identifier of the member to re-invite.</param>
[HttpPost("{id}/reinvite")]
[ProducesResponseType((int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(ErrorResponseModel), (int)HttpStatusCode.BadRequest)]
[ProducesResponseType((int)HttpStatusCode.NotFound)]
public async Task<IActionResult> PostReinvite(Guid id)
{
var existingUser = await _organizationUserRepository.GetByIdAsync(id);
if(existingUser == null || existingUser.OrganizationId != _currentContext.OrganizationId)
{
return new NotFoundResult();
}
await _organizationService.ResendInviteAsync(_currentContext.OrganizationId.Value, null, id);
return new OkResult();
}
}
}

View File

@ -33,7 +33,7 @@ namespace Bit.Core.Services
OrganizationUserType type, bool accessAll, string externalId, IEnumerable<SelectionReadOnly> collections);
Task<List<OrganizationUser>> InviteUserAsync(Guid organizationId, Guid? invitingUserId, IEnumerable<string> emails,
OrganizationUserType type, bool accessAll, string externalId, IEnumerable<SelectionReadOnly> collections);
Task ResendInviteAsync(Guid organizationId, Guid invitingUserId, Guid organizationUserId);
Task ResendInviteAsync(Guid organizationId, Guid? invitingUserId, Guid organizationUserId);
Task<OrganizationUser> AcceptUserAsync(Guid organizationUserId, User user, string token);
Task<OrganizationUser> ConfirmUserAsync(Guid organizationId, Guid organizationUserId, string key, Guid confirmingUserId);
Task SaveUserAsync(OrganizationUser user, Guid? savingUserId, IEnumerable<SelectionReadOnly> collections);

View File

@ -914,7 +914,7 @@ namespace Bit.Core.Services
return orgUsers;
}
public async Task ResendInviteAsync(Guid organizationId, Guid invitingUserId, Guid organizationUserId)
public async Task ResendInviteAsync(Guid organizationId, Guid? invitingUserId, Guid organizationUserId)
{
var orgUser = await _organizationUserRepository.GetByIdAsync(organizationUserId);
if(orgUser == null || orgUser.OrganizationId != organizationId ||