From 73bab739eebd363a55de210b3b5a873e4d22db93 Mon Sep 17 00:00:00 2001 From: VasanthaKasirajan3008 <56582101+VasanthaKasirajan3008@users.noreply.github.com> Date: Thu, 16 Jun 2022 12:24:21 +0100 Subject: [PATCH 1/2] MAP-78- Log all the EAS redirect handlers which go to commitments v1 --- .../Attributes/DeprecatedAttribute.cs | 26 +++++++++++++++++++ .../EmployerCommitmentsController.cs | 13 ++++++++++ .../EmployerManageApprenticesController.cs | 7 +++++ src/SFA.DAS.EAS.Web/SFA.DAS.EAS.Web.csproj | 3 ++- .../Attributes/DeprecatedAttribute.cs | 26 +++++++++++++++++++ .../EmployerCommitmentsController.cs | 13 ++++++++++ .../EmployerManageApprenticesController.cs | 7 +++++ .../SFA.DAS.EmployerAccounts.Web.csproj | 1 + 8 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 src/SFA.DAS.EAS.Web/Attributes/DeprecatedAttribute.cs create mode 100644 src/SFA.DAS.EmployerAccounts.Web/Attributes/DeprecatedAttribute.cs diff --git a/src/SFA.DAS.EAS.Web/Attributes/DeprecatedAttribute.cs b/src/SFA.DAS.EAS.Web/Attributes/DeprecatedAttribute.cs new file mode 100644 index 0000000000..036e48c12c --- /dev/null +++ b/src/SFA.DAS.EAS.Web/Attributes/DeprecatedAttribute.cs @@ -0,0 +1,26 @@ +using NLog; +using System; +using System.Web.Mvc; + +namespace SFA.DAS.EAS.Web.Attributes +{ + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] + public class DeprecatedAttribute : ActionFilterAttribute + { + private static readonly ILogger Logger = LogManager.GetCurrentClassLogger(); + + public override void OnActionExecuting(ActionExecutingContext filterContext) + { + var urlReferrer = filterContext.RequestContext.HttpContext.Request.UrlReferrer; + var referrer = urlReferrer == null ? "unknown" : urlReferrer.ToString(); + + var rawUrl = filterContext.RequestContext.HttpContext.Request.RawUrl; + + var controllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName; + var actionName = filterContext.ActionDescriptor.ActionName; + + Logger.Info($"To track Apprentice V1 details landing on EAS.Web: UrlReferrer Request: {referrer} Request to Page: {rawUrl} Handled At: {controllerName}.{actionName}"); + base.OnActionExecuting(filterContext); + } + } +} \ No newline at end of file diff --git a/src/SFA.DAS.EAS.Web/Controllers/EmployerCommitmentsController.cs b/src/SFA.DAS.EAS.Web/Controllers/EmployerCommitmentsController.cs index fdd3c6b697..7bdf773e70 100644 --- a/src/SFA.DAS.EAS.Web/Controllers/EmployerCommitmentsController.cs +++ b/src/SFA.DAS.EAS.Web/Controllers/EmployerCommitmentsController.cs @@ -2,6 +2,7 @@ using System.Web.Mvc; using SFA.DAS.Authorization.Mvc.Attributes; using SFA.DAS.EAS.Domain.Configuration; +using SFA.DAS.EAS.Web.Attributes; using SFA.DAS.EAS.Web.Helpers; using SFA.DAS.EAS.Web.ViewModels; @@ -24,6 +25,7 @@ public EmployerCommitmentsController(EmployerApprenticeshipsServiceConfiguration [Route("cohorts/provider")] [Route("Inform")] [Route("confirmProvider/create")] + [Deprecated] public ActionResult Index(string hashedAccountId) { return RedirectPermanentCommitmentsUrl(); @@ -33,6 +35,7 @@ public ActionResult Index(string hashedAccountId) [OutputCache(CacheProfile = "NoCache")] [Route("cohorts")] [Route("cohorts/draft")] + [Deprecated] public ActionResult YourCohorts(string hashedAccountId) { return RedirectPermanentCommitmentsUrl(); @@ -40,6 +43,7 @@ public ActionResult YourCohorts(string hashedAccountId) [HttpGet] [Route("legalEntity/create")] + [Deprecated] public ActionResult SelectLegalEntity(string hashedAccountId, string cohortRef = "") { return RedirectPermanentCommitmentsUrl(); @@ -47,6 +51,7 @@ public ActionResult SelectLegalEntity(string hashedAccountId, string cohortRef = [HttpGet] [Route("provider/create")] + [Deprecated] public ActionResult SearchProvider(string hashedAccountId, string legalEntityCode, string cohortRef) { return RedirectPermanentCommitmentsUrl(); @@ -54,6 +59,7 @@ public ActionResult SearchProvider(string hashedAccountId, string legalEntityCod [HttpGet] [Route("choosePath/create")] + [Deprecated] public ActionResult ChoosePath(string hashedAccountId, string legalEntityCode, string providerId, string cohortRef) { return RedirectPermanentCommitmentsUrl(); @@ -66,6 +72,7 @@ public ActionResult ChoosePath(string hashedAccountId, string legalEntityCode, s [Route("{hashedCommitmentId}/apprenticeships/create")] [Route("{hashedCommitmentId}/finished")] [Route("{hashedCommitmentId}/CohortApproved")] + [Deprecated] public ActionResult Details(string hashedAccountId, string hashedCommitmentId) { return RedirectPermanentCommitmentsUrl(); @@ -73,6 +80,7 @@ public ActionResult Details(string hashedAccountId, string hashedCommitmentId) [HttpGet] [Route("{legalEntityCode}/AgreementNotSigned")] + [Deprecated] public ActionResult AgreementNotSigned(LegalEntitySignedAgreementViewModel viewModel) { return RedirectPermanentCommitmentsUrl(); @@ -83,6 +91,7 @@ public ActionResult AgreementNotSigned(LegalEntitySignedAgreementViewModel viewM [Route("{hashedCommitmentId}/apprenticeships/{hashedApprenticeshipId}/edit")] [Route("{hashedCommitmentId}/apprenticeships/{hashedApprenticeshipId}/view")] [Route("{hashedCommitmentId}/Apprenticeships/{hashedApprenticeshipId}/Delete")] + [Deprecated] public ActionResult EditApprenticeship(string hashedAccountId, string hashedCommitmentId, string hashedApprenticeshipId) { return RedirectPermanentCommitmentsUrl(); @@ -91,6 +100,7 @@ public ActionResult EditApprenticeship(string hashedAccountId, string hashedComm [HttpGet] [OutputCache(CacheProfile = "NoCache")] [Route("{hashedCommitmentId}/submit")] + [Deprecated] public ActionResult SubmitExistingCommitment(string hashedAccountId, string hashedCommitmentId) { return RedirectPermanentCommitmentsUrl(); @@ -99,6 +109,7 @@ public ActionResult SubmitExistingCommitment(string hashedAccountId, string hash [HttpGet] [OutputCache(CacheProfile = "NoCache")] [Route("Submit")] + [Deprecated] public ActionResult SubmitNewCommitment(string hashedAccountId, string legalEntityCode, string legalEntityName, string legalEntityAddress, short legalEntitySource, string providerId, string providerName, string cohortRef) { return RedirectPermanentCommitmentsUrl(); @@ -106,6 +117,7 @@ public ActionResult SubmitNewCommitment(string hashedAccountId, string legalEnti [HttpGet] [Route("{hashedCommitmentId}/NewCohortAcknowledgement")] + [Deprecated] public ActionResult AcknowledgementNew(string hashedAccountId, string hashedCommitmentId) { return RedirectPermanentCommitmentsUrl(); @@ -113,6 +125,7 @@ public ActionResult AcknowledgementNew(string hashedAccountId, string hashedComm [HttpGet] [Route("{hashedCommitmentId}/Acknowledgement")] + [Deprecated] public ActionResult AcknowledgementExisting(string hashedAccountId, string hashedCommitmentId) { return RedirectPermanentCommitmentsUrl(); diff --git a/src/SFA.DAS.EAS.Web/Controllers/EmployerManageApprenticesController.cs b/src/SFA.DAS.EAS.Web/Controllers/EmployerManageApprenticesController.cs index 91bcef7f5a..fcbf5810b0 100644 --- a/src/SFA.DAS.EAS.Web/Controllers/EmployerManageApprenticesController.cs +++ b/src/SFA.DAS.EAS.Web/Controllers/EmployerManageApprenticesController.cs @@ -2,6 +2,7 @@ using System.Web.Mvc; using SFA.DAS.Authorization.Mvc.Attributes; using SFA.DAS.EAS.Domain.Configuration; +using SFA.DAS.EAS.Web.Attributes; using SFA.DAS.EAS.Web.Helpers; using SFA.DAS.NLog.Logger; @@ -23,6 +24,7 @@ public EmployerManageApprenticesController(EmployerApprenticeshipsServiceConfigu [HttpGet] [Route("all")] [OutputCache(CacheProfile = "NoCache")] + [Deprecated] public ActionResult ListAll(string hashedAccountId) { return RedirectPermanentCommitmentsUrl(); @@ -33,6 +35,7 @@ public ActionResult ListAll(string hashedAccountId) [Route("{hashedApprenticeshipId}/details", Name = "OnProgrammeApprenticeshipDetails")] [Route("{hashedApprenticeshipId}/details/statuschange", Name = "ChangeStatusSelectOption")] [Route("{hashedApprenticeshipId}/edit", Name = "EditApprenticeship")] + [Deprecated] public ActionResult Details(string hashedAccountId, string hashedApprenticeshipId) { _logger.Info($"To track Apprentice V1 details UrlReferrer Request: {HttpContext.Request.UrlReferrer}"); @@ -43,6 +46,7 @@ public ActionResult Details(string hashedAccountId, string hashedApprenticeshipI [HttpGet] [Route("{hashedApprenticeshipId}/details/statuschange/{changeType}/whentoapply", Name = "WhenToApplyChange")] [OutputCache(CacheProfile = "NoCache")] + [Deprecated] public ActionResult WhenToApplyChange(string hashedAccountId, string hashedApprenticeshipId) { return RedirectPermanentCommitmentsUrl(); @@ -51,6 +55,7 @@ public ActionResult WhenToApplyChange(string hashedAccountId, string hashedAppre [HttpGet] [Route("{hashedApprenticeshipId}/details/statuschange/{changeType}/confirm", Name = "StatusChangeConfirmation")] [OutputCache(CacheProfile = "NoCache")] + [Deprecated] public ActionResult StatusChangeConfirmation(string hashedAccountId, string hashedApprenticeshipId) { return RedirectPermanentCommitmentsUrl(); @@ -62,6 +67,7 @@ public ActionResult StatusChangeConfirmation(string hashedAccountId, string hash [Route("{hashedApprenticeshipId}/changes/review", Name = "ReviewChanges")] [Route("{hashedApprenticeshipId}/datalock/restart", Name = "RequestRestart")] [Route("{hashedApprenticeshipId}/datalock/changes", Name = "RequestChanges")] + [Deprecated] public ActionResult ConfirmChanges(string hashedAccountId, string hashedApprenticeshipId) { return RedirectPermanentCommitmentsUrl(); @@ -69,6 +75,7 @@ public ActionResult ConfirmChanges(string hashedAccountId, string hashedApprenti [HttpGet] [Route("paymentorder", Name = "PaymentOrder")] + [Deprecated] public ActionResult PaymentOrder(string hashedAccountId) { return RedirectPermanentCommitmentsUrl(); diff --git a/src/SFA.DAS.EAS.Web/SFA.DAS.EAS.Web.csproj b/src/SFA.DAS.EAS.Web/SFA.DAS.EAS.Web.csproj index 73c139749b..d2c8a0b0f7 100644 --- a/src/SFA.DAS.EAS.Web/SFA.DAS.EAS.Web.csproj +++ b/src/SFA.DAS.EAS.Web/SFA.DAS.EAS.Web.csproj @@ -52,6 +52,7 @@ + @@ -690,4 +691,4 @@ --> - + \ No newline at end of file diff --git a/src/SFA.DAS.EmployerAccounts.Web/Attributes/DeprecatedAttribute.cs b/src/SFA.DAS.EmployerAccounts.Web/Attributes/DeprecatedAttribute.cs new file mode 100644 index 0000000000..261b5cf3ce --- /dev/null +++ b/src/SFA.DAS.EmployerAccounts.Web/Attributes/DeprecatedAttribute.cs @@ -0,0 +1,26 @@ +using System; +using System.Web.Mvc; +using NLog; + +namespace SFA.DAS.EmployerAccounts.Web.Attributes +{ + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] + public class DeprecatedAttribute : ActionFilterAttribute + { + private static readonly ILogger Logger = LogManager.GetCurrentClassLogger(); + + public override void OnActionExecuting(ActionExecutingContext filterContext) + { + var urlReferrer = filterContext.RequestContext.HttpContext.Request.UrlReferrer; + var referrer = urlReferrer == null ? "unknown" : urlReferrer.ToString(); + + var rawUrl = filterContext.RequestContext.HttpContext.Request.RawUrl; + + var controllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName; + var actionName = filterContext.ActionDescriptor.ActionName; + + Logger.Info($"To track Apprentice V1 details landing on EmployerAccounts.Web: UrlReferrer Request: {referrer} Request to Page: {rawUrl} Handled At: {controllerName}.{actionName}"); + base.OnActionExecuting(filterContext); + } + } +} \ No newline at end of file diff --git a/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerCommitmentsController.cs b/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerCommitmentsController.cs index 5553001245..0be4258766 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerCommitmentsController.cs +++ b/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerCommitmentsController.cs @@ -1,6 +1,7 @@ using System.Web.Mvc; using SFA.DAS.Authorization.Mvc.Attributes; using SFA.DAS.EmployerAccounts.Configuration; +using SFA.DAS.EmployerAccounts.Web.Attributes; using SFA.DAS.EmployerAccounts.Web.ViewModels; namespace SFA.DAS.EmployerAccounts.Web.Controllers @@ -22,6 +23,7 @@ public EmployerCommitmentsController(EmployerAccountsConfiguration employerAccou [Route("cohorts/provider")] [Route("Inform")] [Route("confirmProvider/create")] + [Deprecated] public ActionResult Index(string hashedAccountId) { return RedirectPermanentCommitmentsUrl(); @@ -31,6 +33,7 @@ public ActionResult Index(string hashedAccountId) [OutputCache(CacheProfile = "NoCache")] [Route("cohorts")] [Route("cohorts/draft")] + [Deprecated] public ActionResult YourCohorts(string hashedAccountId) { return RedirectPermanentCommitmentsUrl(); @@ -38,6 +41,7 @@ public ActionResult YourCohorts(string hashedAccountId) [HttpGet] [Route("legalEntity/create")] + [Deprecated] public ActionResult SelectLegalEntity(string hashedAccountId, string cohortRef = "") { return RedirectPermanentCommitmentsUrl(); @@ -45,6 +49,7 @@ public ActionResult SelectLegalEntity(string hashedAccountId, string cohortRef = [HttpGet] [Route("provider/create")] + [Deprecated] public ActionResult SearchProvider(string hashedAccountId, string legalEntityCode, string cohortRef) { return RedirectPermanentCommitmentsUrl(); @@ -52,6 +57,7 @@ public ActionResult SearchProvider(string hashedAccountId, string legalEntityCod [HttpGet] [Route("choosePath/create")] + [Deprecated] public ActionResult ChoosePath(string hashedAccountId, string legalEntityCode, string providerId, string cohortRef) { return RedirectPermanentCommitmentsUrl(); @@ -64,6 +70,7 @@ public ActionResult ChoosePath(string hashedAccountId, string legalEntityCode, s [Route("{hashedCommitmentId}/apprenticeships/create")] [Route("{hashedCommitmentId}/finished")] [Route("{hashedCommitmentId}/CohortApproved")] + [Deprecated] public ActionResult Details(string hashedAccountId, string hashedCommitmentId) { return RedirectPermanentCommitmentsUrl(); @@ -71,6 +78,7 @@ public ActionResult Details(string hashedAccountId, string hashedCommitmentId) [HttpGet] [Route("{legalEntityCode}/AgreementNotSigned")] + [Deprecated] public ActionResult AgreementNotSigned(LegalEntitySignedAgreementViewModel viewModel) { return RedirectPermanentCommitmentsUrl(); @@ -81,6 +89,7 @@ public ActionResult AgreementNotSigned(LegalEntitySignedAgreementViewModel viewM [Route("{hashedCommitmentId}/apprenticeships/{hashedApprenticeshipId}/edit")] [Route("{hashedCommitmentId}/apprenticeships/{hashedApprenticeshipId}/view")] [Route("{hashedCommitmentId}/Apprenticeships/{hashedApprenticeshipId}/Delete")] + [Deprecated] public ActionResult EditApprenticeship(string hashedAccountId, string hashedCommitmentId, string hashedApprenticeshipId) { return RedirectPermanentCommitmentsUrl(); @@ -89,6 +98,7 @@ public ActionResult EditApprenticeship(string hashedAccountId, string hashedComm [HttpGet] [OutputCache(CacheProfile = "NoCache")] [Route("{hashedCommitmentId}/submit")] + [Deprecated] public ActionResult SubmitExistingCommitment(string hashedAccountId, string hashedCommitmentId) { return RedirectPermanentCommitmentsUrl(); @@ -97,6 +107,7 @@ public ActionResult SubmitExistingCommitment(string hashedAccountId, string hash [HttpGet] [OutputCache(CacheProfile = "NoCache")] [Route("Submit")] + [Deprecated] public ActionResult SubmitNewCommitment(string hashedAccountId, string legalEntityCode, string legalEntityName, string legalEntityAddress, short legalEntitySource, string providerId, string providerName, string cohortRef) { return RedirectPermanentCommitmentsUrl(); @@ -104,6 +115,7 @@ public ActionResult SubmitNewCommitment(string hashedAccountId, string legalEnti [HttpGet] [Route("{hashedCommitmentId}/NewCohortAcknowledgement")] + [Deprecated] public ActionResult AcknowledgementNew(string hashedAccountId, string hashedCommitmentId) { return RedirectPermanentCommitmentsUrl(); @@ -111,6 +123,7 @@ public ActionResult AcknowledgementNew(string hashedAccountId, string hashedComm [HttpGet] [Route("{hashedCommitmentId}/Acknowledgement")] + [Deprecated] public ActionResult AcknowledgementExisting(string hashedAccountId, string hashedCommitmentId) { return RedirectPermanentCommitmentsUrl(); diff --git a/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerManageApprenticesController.cs b/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerManageApprenticesController.cs index a8fe228604..38710097c7 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerManageApprenticesController.cs +++ b/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerManageApprenticesController.cs @@ -1,6 +1,7 @@ using System.Web.Mvc; using SFA.DAS.Authorization.Mvc.Attributes; using SFA.DAS.EmployerAccounts.Configuration; +using SFA.DAS.EmployerAccounts.Web.Attributes; using SFA.DAS.NLog.Logger; namespace SFA.DAS.EmployerAccounts.Web.Controllers @@ -21,6 +22,7 @@ public EmployerManageApprenticesController(EmployerAccountsConfiguration employe [HttpGet] [Route("all")] [OutputCache(CacheProfile = "NoCache")] + [Deprecated] public ActionResult ListAll(string hashedAccountId) { return RedirectPermanentCommitmentsUrl(); @@ -31,6 +33,7 @@ public ActionResult ListAll(string hashedAccountId) [Route("{hashedApprenticeshipId}/details", Name = "OnProgrammeApprenticeshipDetails")] [Route("{hashedApprenticeshipId}/details/statuschange", Name = "ChangeStatusSelectOption")] [Route("{hashedApprenticeshipId}/edit", Name = "EditApprenticeship")] + [Deprecated] public ActionResult Details(string hashedAccountId, string hashedApprenticeshipId) { _logger.Info($"To track Apprentice V1 details UrlReferrer Request: {HttpContext.Request.UrlReferrer}"); @@ -41,6 +44,7 @@ public ActionResult Details(string hashedAccountId, string hashedApprenticeshipI [HttpGet] [Route("{hashedApprenticeshipId}/details/statuschange/{changeType}/whentoapply", Name = "WhenToApplyChange")] [OutputCache(CacheProfile = "NoCache")] + [Deprecated] public ActionResult WhenToApplyChange(string hashedAccountId, string hashedApprenticeshipId) { return RedirectPermanentCommitmentsUrl(); @@ -49,6 +53,7 @@ public ActionResult WhenToApplyChange(string hashedAccountId, string hashedAppre [HttpGet] [Route("{hashedApprenticeshipId}/details/statuschange/{changeType}/confirm", Name = "StatusChangeConfirmation")] [OutputCache(CacheProfile = "NoCache")] + [Deprecated] public ActionResult StatusChangeConfirmation(string hashedAccountId, string hashedApprenticeshipId) { return RedirectPermanentCommitmentsUrl(); @@ -60,6 +65,7 @@ public ActionResult StatusChangeConfirmation(string hashedAccountId, string hash [Route("{hashedApprenticeshipId}/changes/review", Name = "ReviewChanges")] [Route("{hashedApprenticeshipId}/datalock/restart", Name = "RequestRestart")] [Route("{hashedApprenticeshipId}/datalock/changes", Name = "RequestChanges")] + [Deprecated] public ActionResult ConfirmChanges(string hashedAccountId, string hashedApprenticeshipId) { return RedirectPermanentCommitmentsUrl(); @@ -67,6 +73,7 @@ public ActionResult ConfirmChanges(string hashedAccountId, string hashedApprenti [HttpGet] [Route("paymentorder", Name = "PaymentOrder")] + [Deprecated] public ActionResult PaymentOrder(string hashedAccountId) { return RedirectPermanentCommitmentsUrl(); diff --git a/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj b/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj index a2b12f8377..97e2e36641 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj +++ b/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj @@ -180,6 +180,7 @@ + From efc24b6310b1d26f200b6576b7164123a17a956f Mon Sep 17 00:00:00 2001 From: VasanthaKasirajan3008 <56582101+VasanthaKasirajan3008@users.noreply.github.com> Date: Thu, 16 Jun 2022 14:04:31 +0100 Subject: [PATCH 2/2] MAP-78 --- .../EmployerCommitmentsController.cs | 6 ++--- .../EmployerManageApprenticesController.cs | 6 ++--- src/SFA.DAS.EAS.Web/SFA.DAS.EAS.Web.csproj | 1 - .../Attributes/DeprecatedAttribute.cs | 26 ------------------- .../EmployerCommitmentsController.cs | 2 +- .../EmployerManageApprenticesController.cs | 2 +- .../SFA.DAS.EmployerAccounts.Web.csproj | 1 - .../Attributes/DeprecatedAttribute.cs | 6 ++--- .../SFA.DAS.EAS.Infrastructure.csproj | 1 + 9 files changed, 10 insertions(+), 41 deletions(-) delete mode 100644 src/SFA.DAS.EmployerAccounts.Web/Attributes/DeprecatedAttribute.cs rename src/{SFA.DAS.EAS.Web => SFA.DAS.EmployerApprenticeshipsService.Infrastructure}/Attributes/DeprecatedAttribute.cs (85%) diff --git a/src/SFA.DAS.EAS.Web/Controllers/EmployerCommitmentsController.cs b/src/SFA.DAS.EAS.Web/Controllers/EmployerCommitmentsController.cs index 7bdf773e70..bdad4e60a2 100644 --- a/src/SFA.DAS.EAS.Web/Controllers/EmployerCommitmentsController.cs +++ b/src/SFA.DAS.EAS.Web/Controllers/EmployerCommitmentsController.cs @@ -1,9 +1,7 @@ -using System.Configuration; -using System.Web.Mvc; +using System.Web.Mvc; using SFA.DAS.Authorization.Mvc.Attributes; using SFA.DAS.EAS.Domain.Configuration; -using SFA.DAS.EAS.Web.Attributes; -using SFA.DAS.EAS.Web.Helpers; +using SFA.DAS.EAS.Infrastructure.Attributes; using SFA.DAS.EAS.Web.ViewModels; namespace SFA.DAS.EAS.Web.Controllers diff --git a/src/SFA.DAS.EAS.Web/Controllers/EmployerManageApprenticesController.cs b/src/SFA.DAS.EAS.Web/Controllers/EmployerManageApprenticesController.cs index fcbf5810b0..6b64a5c316 100644 --- a/src/SFA.DAS.EAS.Web/Controllers/EmployerManageApprenticesController.cs +++ b/src/SFA.DAS.EAS.Web/Controllers/EmployerManageApprenticesController.cs @@ -1,9 +1,7 @@ -using System.Configuration; -using System.Web.Mvc; +using System.Web.Mvc; using SFA.DAS.Authorization.Mvc.Attributes; using SFA.DAS.EAS.Domain.Configuration; -using SFA.DAS.EAS.Web.Attributes; -using SFA.DAS.EAS.Web.Helpers; +using SFA.DAS.EAS.Infrastructure.Attributes; using SFA.DAS.NLog.Logger; namespace SFA.DAS.EAS.Web.Controllers diff --git a/src/SFA.DAS.EAS.Web/SFA.DAS.EAS.Web.csproj b/src/SFA.DAS.EAS.Web/SFA.DAS.EAS.Web.csproj index d2c8a0b0f7..5daca52ba9 100644 --- a/src/SFA.DAS.EAS.Web/SFA.DAS.EAS.Web.csproj +++ b/src/SFA.DAS.EAS.Web/SFA.DAS.EAS.Web.csproj @@ -52,7 +52,6 @@ - diff --git a/src/SFA.DAS.EmployerAccounts.Web/Attributes/DeprecatedAttribute.cs b/src/SFA.DAS.EmployerAccounts.Web/Attributes/DeprecatedAttribute.cs deleted file mode 100644 index 261b5cf3ce..0000000000 --- a/src/SFA.DAS.EmployerAccounts.Web/Attributes/DeprecatedAttribute.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Web.Mvc; -using NLog; - -namespace SFA.DAS.EmployerAccounts.Web.Attributes -{ - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - public class DeprecatedAttribute : ActionFilterAttribute - { - private static readonly ILogger Logger = LogManager.GetCurrentClassLogger(); - - public override void OnActionExecuting(ActionExecutingContext filterContext) - { - var urlReferrer = filterContext.RequestContext.HttpContext.Request.UrlReferrer; - var referrer = urlReferrer == null ? "unknown" : urlReferrer.ToString(); - - var rawUrl = filterContext.RequestContext.HttpContext.Request.RawUrl; - - var controllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName; - var actionName = filterContext.ActionDescriptor.ActionName; - - Logger.Info($"To track Apprentice V1 details landing on EmployerAccounts.Web: UrlReferrer Request: {referrer} Request to Page: {rawUrl} Handled At: {controllerName}.{actionName}"); - base.OnActionExecuting(filterContext); - } - } -} \ No newline at end of file diff --git a/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerCommitmentsController.cs b/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerCommitmentsController.cs index 0be4258766..06f3327f74 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerCommitmentsController.cs +++ b/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerCommitmentsController.cs @@ -1,7 +1,7 @@ using System.Web.Mvc; using SFA.DAS.Authorization.Mvc.Attributes; +using SFA.DAS.EAS.Infrastructure.Attributes; using SFA.DAS.EmployerAccounts.Configuration; -using SFA.DAS.EmployerAccounts.Web.Attributes; using SFA.DAS.EmployerAccounts.Web.ViewModels; namespace SFA.DAS.EmployerAccounts.Web.Controllers diff --git a/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerManageApprenticesController.cs b/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerManageApprenticesController.cs index 38710097c7..7137d00063 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerManageApprenticesController.cs +++ b/src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerManageApprenticesController.cs @@ -1,7 +1,7 @@ using System.Web.Mvc; using SFA.DAS.Authorization.Mvc.Attributes; +using SFA.DAS.EAS.Infrastructure.Attributes; using SFA.DAS.EmployerAccounts.Configuration; -using SFA.DAS.EmployerAccounts.Web.Attributes; using SFA.DAS.NLog.Logger; namespace SFA.DAS.EmployerAccounts.Web.Controllers diff --git a/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj b/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj index 97e2e36641..a2b12f8377 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj +++ b/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj @@ -180,7 +180,6 @@ - diff --git a/src/SFA.DAS.EAS.Web/Attributes/DeprecatedAttribute.cs b/src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/Attributes/DeprecatedAttribute.cs similarity index 85% rename from src/SFA.DAS.EAS.Web/Attributes/DeprecatedAttribute.cs rename to src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/Attributes/DeprecatedAttribute.cs index 036e48c12c..0e806916c1 100644 --- a/src/SFA.DAS.EAS.Web/Attributes/DeprecatedAttribute.cs +++ b/src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/Attributes/DeprecatedAttribute.cs @@ -2,7 +2,7 @@ using System; using System.Web.Mvc; -namespace SFA.DAS.EAS.Web.Attributes +namespace SFA.DAS.EAS.Infrastructure.Attributes { [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public class DeprecatedAttribute : ActionFilterAttribute @@ -19,8 +19,8 @@ public override void OnActionExecuting(ActionExecutingContext filterContext) var controllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName; var actionName = filterContext.ActionDescriptor.ActionName; - Logger.Info($"To track Apprentice V1 details landing on EAS.Web: UrlReferrer Request: {referrer} Request to Page: {rawUrl} Handled At: {controllerName}.{actionName}"); + Logger.Info($"To track Apprentice V1 details landing on EAS: UrlReferrer Request: {referrer} Request to Page: {rawUrl} Handled At: {controllerName}.{actionName}"); base.OnActionExecuting(filterContext); } } -} \ No newline at end of file +} diff --git a/src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/SFA.DAS.EAS.Infrastructure.csproj b/src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/SFA.DAS.EAS.Infrastructure.csproj index 5601d78f9c..eaba6c8733 100644 --- a/src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/SFA.DAS.EAS.Infrastructure.csproj +++ b/src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/SFA.DAS.EAS.Infrastructure.csproj @@ -58,6 +58,7 @@ +