From 170f2ea6565123db29f626c5d2b973b466670e2c Mon Sep 17 00:00:00 2001 From: Todd Martin Date: Thu, 18 Jan 2024 12:20:31 -0500 Subject: [PATCH] Removed AcceptOrgUserByOrgId and replaced with existing method. --- .../OrganizationUsersController.cs | 2 +- .../OrganizationUsers/AcceptOrgUserCommand.cs | 24 ------------------- .../Interfaces/IAcceptOrgUserCommand.cs | 1 - 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/src/Api/AdminConsole/Controllers/OrganizationUsersController.cs b/src/Api/AdminConsole/Controllers/OrganizationUsersController.cs index 1eacab68b..783bfb368 100644 --- a/src/Api/AdminConsole/Controllers/OrganizationUsersController.cs +++ b/src/Api/AdminConsole/Controllers/OrganizationUsersController.cs @@ -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); } } diff --git a/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/AcceptOrgUserCommand.cs b/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/AcceptOrgUserCommand.cs index e0c2bada4..0ad0d563d 100644 --- a/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/AcceptOrgUserCommand.cs +++ b/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/AcceptOrgUserCommand.cs @@ -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 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 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 AcceptOrgUserAsync(OrganizationUser orgUser, User user, IUserService userService) { diff --git a/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/Interfaces/IAcceptOrgUserCommand.cs b/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/Interfaces/IAcceptOrgUserCommand.cs index 14cabda52..ec9d0dcf8 100644 --- a/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/Interfaces/IAcceptOrgUserCommand.cs +++ b/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/Interfaces/IAcceptOrgUserCommand.cs @@ -13,6 +13,5 @@ public interface IAcceptOrgUserCommand /// The accepted OrganizationUser. Task AcceptOrgUserByEmailTokenAsync(Guid organizationUserId, User user, string emailToken, IUserService userService); Task AcceptOrgUserByOrgSsoIdAsync(string orgIdentifier, User user, IUserService userService); - Task AcceptOrgUserByOrgIdAsync(Guid organizationId, User user, IUserService userService); Task AcceptOrgUserAsync(OrganizationUser orgUser, User user, IUserService userService); }