upgrading RSecurityBackend

This commit is contained in:
Hamid Reza Mohammadi 2025-01-25 17:40:26 +03:30
parent dfc892590b
commit 107122d58f
9 changed files with 9919 additions and 3938 deletions

View File

@ -50,7 +50,7 @@ namespace RMuseum.Controllers
var l = res.Result;
bool keepHistory = false;
var kRes = await _optionsService.GetValueAsync("KeepHistory", l.User.Id);
var kRes = await _optionsService.GetValueAsync("KeepHistory", l.User.Id, null);
if (!string.IsNullOrEmpty(kRes.Result))
bool.TryParse(kRes.Result, out keepHistory);
@ -92,7 +92,7 @@ namespace RMuseum.Controllers
var l = res.Result;
bool keepHistory = false;
var kRes = await _optionsService.GetValueAsync("KeepHistory", l.User.Id);
var kRes = await _optionsService.GetValueAsync("KeepHistory", l.User.Id, null);
if (!string.IsNullOrEmpty(kRes.Result))
bool.TryParse(kRes.Result, out keepHistory);

View File

@ -249,50 +249,7 @@ namespace RMuseum.DbContext
builder.Entity<GanjoorPoem>()
.Property(e => e.PoemSummary)
.HasMaxLength(3000);
/*
builder.Entity<RArtifactMasterRecord>()
.Property(e => e.FriendlyUrl)
.HasMaxLength(64);
builder.Entity<RArtifactMasterRecord>()
.Property(e => e.Name)
.HasMaxLength(1200);
builder.Entity<RArtifactMasterRecord>()
.Property(e => e.NameInEnglish)
.HasMaxLength(1200);
builder.Entity<RArtifactItemRecord>()
.Property(e => e.FriendlyUrl)
.HasMaxLength(16);
builder.Entity<RArtifactItemRecord>()
.Property(e => e.Name)
.HasMaxLength(1200);
builder.Entity<RArtifactItemRecord>()
.Property(e => e.NameInEnglish)
.HasMaxLength(1200);
builder.Entity<RTag>()
.Property(e => e.Name)
.HasMaxLength(128);
builder.Entity<RTag>()
.Property(e => e.NameInEnglish)
.HasMaxLength(128);
builder.Entity<RTag>()
.Property(e => e.PluralName)
.HasMaxLength(128);
builder.Entity<RTag>()
.Property(e => e.PluralNameInEnglish)
.HasMaxLength(128);
*/
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,49 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace RMuseum.Migrations
{
/// <inheritdoc />
public partial class WSOptions : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "WorkspaceId",
table: "Options",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Options_WorkspaceId",
table: "Options",
column: "WorkspaceId");
migrationBuilder.AddForeignKey(
name: "FK_Options_RWorkspaces_WorkspaceId",
table: "Options",
column: "WorkspaceId",
principalTable: "RWorkspaces",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Options_RWorkspaces_WorkspaceId",
table: "Options");
migrationBuilder.DropIndex(
name: "IX_Options_WorkspaceId",
table: "Options");
migrationBuilder.DropColumn(
name: "WorkspaceId",
table: "Options");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NAudio" Version="2.2.1" />
<PackageReference Include="RSecurityBackend" Version="1.5.4" />
<PackageReference Include="RSecurityBackend" Version="1.5.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="7.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />

View File

@ -77,7 +77,7 @@ namespace RMuseum.Services.Implementation
int lastFinishedPoetId = 0;
if (!reset)
{
var resOption = await _optionsService.GetValueAsync("CategoryWordCountsLastPoetId", null);
var resOption = await _optionsService.GetValueAsync("CategoryWordCountsLastPoetId", null, null);
if (!string.IsNullOrEmpty(resOption.Result))
{
lastFinishedPoetId = int.Parse(resOption.Result);

View File

@ -1040,7 +1040,7 @@ namespace RMuseum.Services.Implementation
}
PublishStatus status = PublishStatus.Published;
var keepFirstTimeUsersComments = await _optionsService.GetValueAsync("KeepFirstTimeUsersComments", null);
var keepFirstTimeUsersComments = await _optionsService.GetValueAsync("KeepFirstTimeUsersComments", null, null);
if (keepFirstTimeUsersComments.Result == true.ToString())
{
if ((await _context.GanjoorComments.AsNoTracking().Where(c => c.UserId == userId && c.Status == PublishStatus.Published).AnyAsync()) == false)//First time commenter

View File

@ -26,7 +26,7 @@ namespace RMuseum.Services.Implementation
public async Task<RServiceResult<bool>> AddAsync(Guid userId, int poemId)
{
bool keepHistory = false;
var kRes = await _optionsService.GetValueAsync("KeepHistory", userId);
var kRes = await _optionsService.GetValueAsync("KeepHistory", userId, null);
if (!string.IsNullOrEmpty(kRes.Result))
bool.TryParse(kRes.Result, out keepHistory);
if (!keepHistory)
@ -75,7 +75,7 @@ namespace RMuseum.Services.Implementation
/// <returns></returns>
public async Task<RServiceResult<bool>> SwitchTrackingAsync(Guid userId, bool start)
{
var res = await _optionsService.SetAsync("KeepHistory", start.ToString(), userId);
var res = await _optionsService.SetAsync("KeepHistory", start.ToString(), userId, null);
if (!string.IsNullOrEmpty(res.ExceptionString))
return new RServiceResult<bool>(false, res.ExceptionString);
if(!start)