Refactor constant imports and enhance safety checks
Updated constant imports from static to regular usage across multiple controllers. Improved null safety in `DebugEnvelopes.cshtml` by ensuring the `Receivers` property is not null before access. Modified authorization attribute in `DocumentController.cs` to directly reference `Domain.Constants.ReceiverRole.FullyAuth`.
This commit is contained in:
parent
27d97ed12a
commit
7a84726a3b
@ -2,14 +2,10 @@
|
||||
using EnvelopeGenerator.CommonServices;
|
||||
using EnvelopeGenerator.Web.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using EnvelopeGenerator.Application.Extensions;
|
||||
using EnvelopeGenerator.Application.Interfaces.Services;
|
||||
using static EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers;
|
||||
|
||||
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||
[Authorize(Roles = Domain.Constants.ReceiverRole.FullyAuth)]
|
||||
[Route("api/[controller]")]
|
||||
public class DocumentController : BaseController
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using System.Text.Encodings.Web;
|
||||
using EnvelopeGenerator.Application.Extensions;
|
||||
using EnvelopeGenerator.Application.Interfaces.Services;
|
||||
using static EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
using EnvelopeGenerator.Web.Extensions;
|
||||
|
||||
@ -9,18 +9,16 @@ using EnvelopeGenerator.Application.Resources;
|
||||
using EnvelopeGenerator.Application.Extensions;
|
||||
using EnvelopeGenerator.Web.Extensions;
|
||||
using EnvelopeGenerator.Web.Models;
|
||||
using Ganss.Xss;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Newtonsoft.Json;
|
||||
using OtpNet;
|
||||
using System.Security.Claims;
|
||||
using static EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers;
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ using EnvelopeGenerator.Application.Dto.EnvelopeReceiverReadOnly;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using static EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Web.Extensions;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers
|
||||
|
||||
@ -4,14 +4,13 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using EnvelopeGenerator.Application.Extensions;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using EnvelopeGenerator.Application.Resources;
|
||||
using EnvelopeGenerator.Application.Extensions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using EnvelopeGenerator.Application.Interfaces.Services;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
using static EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Web.Extensions;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers;
|
||||
|
||||
@ -3,7 +3,7 @@ using EnvelopeGenerator.Application.Interfaces.Services;
|
||||
using EnvelopeGenerator.Application.Dto;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using static EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test;
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ using EnvelopeGenerator.Application.Interfaces.Services;
|
||||
using EnvelopeGenerator.Application.Dto.EnvelopeHistory;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using static EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
@using EnvelopeGenerator.CommonServices;
|
||||
@using EnvelopeGenerator.Domain.Entities;
|
||||
@using static EnvelopeGenerator.Domain.Constants;
|
||||
@using EnvelopeGenerator.Domain.Constants;
|
||||
@{
|
||||
ViewData["Title"] = "Debug";
|
||||
}
|
||||
@ -8,8 +8,8 @@
|
||||
@functions {
|
||||
string encodeEnvelopeKey(Envelope envelope)
|
||||
{
|
||||
var receiver = envelope.Receivers.First();
|
||||
return Helpers.EncodeEnvelopeReceiverId(envelope.Uuid, receiver.Receiver.Signature);
|
||||
var receiver = envelope.Receivers!.First();
|
||||
return Helpers.EncodeEnvelopeReceiverId(envelope.Uuid, receiver.Receiver!.Signature);
|
||||
}
|
||||
|
||||
IEnumerable<IGrouping<EnvelopeStatus, Envelope>> groupEnvelopes(List<Envelope> envelopes)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user