mirror of
https://github.com/bitwarden/server.git
synced 2025-02-27 03:41:30 +01:00
Added get for sso config repo by revision date (#878)
This commit is contained in:
parent
80f57d22a7
commit
8884157427
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Bit.Core.Models.Table;
|
using Bit.Core.Models.Table;
|
||||||
|
|
||||||
@ -8,5 +9,6 @@ namespace Bit.Core.Repositories
|
|||||||
{
|
{
|
||||||
Task<SsoConfig> GetByOrganizationIdAsync(Guid organizationId);
|
Task<SsoConfig> GetByOrganizationIdAsync(Guid organizationId);
|
||||||
Task<SsoConfig> GetByIdentifierAsync(string identifier);
|
Task<SsoConfig> GetByIdentifierAsync(string identifier);
|
||||||
|
Task<ICollection<SsoConfig>> GetManyByRevisionNotBeforeDate(DateTime? notBefore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using System.Data.SqlClient;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Bit.Core.Repositories.SqlServer
|
namespace Bit.Core.Repositories.SqlServer
|
||||||
{
|
{
|
||||||
@ -43,5 +44,18 @@ namespace Bit.Core.Repositories.SqlServer
|
|||||||
return results.SingleOrDefault();
|
return results.SingleOrDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<ICollection<SsoConfig>> GetManyByRevisionNotBeforeDate(DateTime? notBefore)
|
||||||
|
{
|
||||||
|
using (var connection = new SqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
var results = await connection.QueryAsync<SsoConfig>(
|
||||||
|
$"[{Schema}].[{Table}_ReadManyByNotBeforeRevisionDate]",
|
||||||
|
new { NotBefore = notBefore },
|
||||||
|
commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
|
return results.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
CREATE PROCEDURE [dbo].[SsoConfig_ReadManyByNotBeforeRevisionDate]
|
||||||
|
@NotBefore DATETIME2(7)
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
SET NOCOUNT ON
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
[dbo].[SsoConfigView]
|
||||||
|
WHERE
|
||||||
|
[Enabled] = 1
|
||||||
|
AND [RevisionDate] >= COALESCE(@NotBefore, [RevisionDate]);
|
||||||
|
END
|
21
util/Migrator/DbScripts/2020-08-19_00_SsoConfigGetAll.sql
Normal file
21
util/Migrator/DbScripts/2020-08-19_00_SsoConfigGetAll.sql
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
IF OBJECT_ID('[dbo].[SsoConfig_ReadManyByNotBeforeRevisionDate]') IS NOT NULL
|
||||||
|
BEGIN
|
||||||
|
DROP PROCEDURE [dbo].[SsoConfig_ReadManyByNotBeforeRevisionDate]
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[SsoConfig_ReadManyByNotBeforeRevisionDate]
|
||||||
|
@NotBefore DATETIME2(7)
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
SET NOCOUNT ON
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
[dbo].[SsoConfigView]
|
||||||
|
WHERE
|
||||||
|
[Enabled] = 1
|
||||||
|
AND [RevisionDate] >= COALESCE(@NotBefore, [RevisionDate]);
|
||||||
|
END
|
||||||
|
GO
|
Loading…
Reference in New Issue
Block a user