1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00
This commit is contained in:
Kyle Spearrin 2017-03-03 21:53:27 -05:00
parent 29e3605576
commit 2f41f260ec
2 changed files with 15 additions and 2 deletions

View File

@ -32,7 +32,20 @@ namespace Bit.Api.Controllers
} }
[HttpGet("{id}")] [HttpGet("{id}")]
public async Task<OrganizationExtendedResponseModel> Get(string id) public async Task<OrganizationResponseModel> 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<OrganizationExtendedResponseModel> GetExtended(string id)
{ {
var userId = _userService.GetProperUserId(User).Value; var userId = _userService.GetProperUserId(User).Value;
var organization = await _organizationRepository.GetByIdAsync(new Guid(id), userId); var organization = await _organizationRepository.GetByIdAsync(new Guid(id), userId);

View File

@ -23,7 +23,7 @@ namespace Bit.Core.Repositories.SqlServer
using(var connection = new SqlConnection(ConnectionString)) using(var connection = new SqlConnection(ConnectionString))
{ {
var results = await connection.QueryAsync<OrganizationUser>( var results = await connection.QueryAsync<OrganizationUser>(
"[dbo].[OrganizationUser_ReadByIdUserId]", "[dbo].[OrganizationUser_ReadByOrganizationIdUserId]",
new { OrganizationId = organizationId, UserId = userId }, new { OrganizationId = organizationId, UserId = userId },
commandType: CommandType.StoredProcedure); commandType: CommandType.StoredProcedure);