Browse Source

Fix bulk fingerprints (#1442)

* Fix fingerprint phrases in bulk confirm modal

* Fix indentation
pull/1443/head
Thomas Rittson 5 years ago committed by GitHub
parent
commit
908e1504af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/Api/Controllers/OrganizationUsersController.cs
  2. 7
      src/Core/Models/Api/Response/OrganizationUserResponseModel.cs
  3. 1
      src/Core/Models/Data/OrganizationUserPublicKey.cs
  4. 1
      src/Sql/dbo/Stored Procedures/User_ReadPublicKeysByOrganizationUserIds.sql
  5. 26
      util/Migrator/DbScripts/2021-07-07_00_FixBulkConfirm.sql

2
src/Api/Controllers/OrganizationUsersController.cs

@ -219,7 +219,7 @@ namespace Bit.Api.Controllers @@ -219,7 +219,7 @@ namespace Bit.Api.Controllers
}
var result = await _organizationUserRepository.GetManyPublicKeysByOrganizationUserAsync(orgGuidId, model.Ids);
var responses = result.Select(r => new OrganizationUserPublicKeyResponseModel(r.Id, r.PublicKey)).ToList();
var responses = result.Select(r => new OrganizationUserPublicKeyResponseModel(r.Id, r.UserId, r.PublicKey)).ToList();
return new ListResponseModel<OrganizationUserPublicKeyResponseModel>(responses);
}

7
src/Core/Models/Api/Response/OrganizationUserResponseModel.cs

@ -111,14 +111,17 @@ namespace Bit.Core.Models.Api @@ -111,14 +111,17 @@ namespace Bit.Core.Models.Api
public class OrganizationUserPublicKeyResponseModel : ResponseModel
{
public OrganizationUserPublicKeyResponseModel(Guid id, string key,
string obj = "organizationUserPublicKeyResponseModel") : base(obj)
public OrganizationUserPublicKeyResponseModel(Guid id, Guid userId,
string key, string obj = "organizationUserPublicKeyResponseModel") :
base(obj)
{
Id = id;
UserId = userId;
Key = key;
}
public Guid Id { get; set; }
public Guid UserId { get; set; }
public string Key { get; set; }
}

1
src/Core/Models/Data/OrganizationUserPublicKey.cs

@ -5,6 +5,7 @@ namespace Bit.Core.Models.Data @@ -5,6 +5,7 @@ namespace Bit.Core.Models.Data
public class OrganizationUserPublicKey
{
public Guid Id { get; set; }
public Guid UserId { get; set; }
public string PublicKey { get; set; }
}
}

1
src/Sql/dbo/Stored Procedures/User_ReadPublicKeysByOrganizationUserIds.sql

@ -7,6 +7,7 @@ BEGIN @@ -7,6 +7,7 @@ BEGIN
SELECT
OU.[Id],
OU.[UserId],
U.[PublicKey]
FROM
@OrganizationUserIds OUIDs

26
util/Migrator/DbScripts/2021-07-07_00_FixBulkConfirm.sql

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
IF OBJECT_ID('[dbo].[User_ReadPublicKeysByOrganizationUserIds]') IS NOT NULL
BEGIN
DROP PROCEDURE [dbo].[User_ReadPublicKeysByOrganizationUserIds]
END
GO
CREATE PROCEDURE [dbo].[User_ReadPublicKeysByOrganizationUserIds]
@OrganizationId UNIQUEIDENTIFIER,
@OrganizationUserIds [dbo].[GuidIdArray] READONLY
AS
BEGIN
SET NOCOUNT ON
SELECT
OU.[Id],
OU.[UserId],
U.[PublicKey]
FROM
@OrganizationUserIds OUIDs
INNER JOIN
[dbo].[OrganizationUser] OU ON OUIDs.Id = OU.Id AND OU.[Status] = 1 -- Accepted
INNER JOIN
[dbo].[User] U ON OU.UserId = U.Id
WHERE
OU.OrganizationId = @OrganizationId
END
Loading…
Cancel
Save