diff --git a/src/Api/Controllers/OrganizationsController.cs b/src/Api/Controllers/OrganizationsController.cs index e514c2a94..073792fba 100644 --- a/src/Api/Controllers/OrganizationsController.cs +++ b/src/Api/Controllers/OrganizationsController.cs @@ -32,7 +32,20 @@ namespace Bit.Api.Controllers } [HttpGet("{id}")] - public async Task Get(string id) + public async Task Get(string id) + { + var userId = _userService.GetProperUserId(User).Value; + var organization = await _organizationRepository.GetByIdAsync(new Guid(id), userId); + if(organization == null) + { + throw new NotFoundException(); + } + + return new OrganizationResponseModel(organization); + } + + [HttpGet("{id}/extended")] + public async Task GetExtended(string id) { var userId = _userService.GetProperUserId(User).Value; var organization = await _organizationRepository.GetByIdAsync(new Guid(id), userId); diff --git a/src/Core/Repositories/SqlServer/OrganizationUserRepository.cs b/src/Core/Repositories/SqlServer/OrganizationUserRepository.cs index 5c1864631..3bf78cde2 100644 --- a/src/Core/Repositories/SqlServer/OrganizationUserRepository.cs +++ b/src/Core/Repositories/SqlServer/OrganizationUserRepository.cs @@ -23,7 +23,7 @@ namespace Bit.Core.Repositories.SqlServer using(var connection = new SqlConnection(ConnectionString)) { var results = await connection.QueryAsync( - "[dbo].[OrganizationUser_ReadByIdUserId]", + "[dbo].[OrganizationUser_ReadByOrganizationIdUserId]", new { OrganizationId = organizationId, UserId = userId }, commandType: CommandType.StoredProcedure);