Skip to content

Commit

Permalink
Merge pull request #186 from bcgov/BCPSDEMS-1335-disable-account-deac…
Browse files Browse the repository at this point in the history
…tivation-on-email

Add flag to ignore email changes
  • Loading branch information
leewrigh authored Aug 1, 2023
2 parents 1cea99c + 2822a4f commit f835885
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion backend/common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime" Version="6.0.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="7.0.9" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.20" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" />
Expand Down
26 changes: 18 additions & 8 deletions backend/webapi/Features/AccessRequests/DigitalEvidenceUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class CommandHandler : ICommandHandler<Command, IDomainResult>
private readonly IOrgUnitService orgUnitService;
private readonly IKafkaProducer<string, EdtUserProvisioning> kafkaProducer;
private readonly IKafkaProducer<string, UserChangeModel> kafkaAccountChangeProducer;
private bool JUSTIN_EMAIL_CHANGE_DISABLED;

private readonly IKafkaProducer<string, Notification> kafkaNotificationProducer;

Expand Down Expand Up @@ -83,6 +84,12 @@ public CommandHandler(
this.kafkaNotificationProducer = kafkaNotificationProducer;
this.orgUnitService = orgUnitService;
this.kafkaAccountChangeProducer = kafkaAccountChangeProducer;
this.JUSTIN_EMAIL_CHANGE_DISABLED = Environment.GetEnvironmentVariable("JUSTIN_EMAIL_CHANGE_DISABLED") != null && bool.Parse(Environment.GetEnvironmentVariable("JUSTIN_EMAIL_CHANGE_DISABLED"));

if (this.JUSTIN_EMAIL_CHANGE_DISABLED)
{
Serilog.Log.Warning("*** JUSTIN Email Account Check is disabled - email changes in JUSTIN wont trigger account changes ***");
}
}


Expand Down Expand Up @@ -335,16 +342,19 @@ private async Task<UserChangeModel> DetermineUserChanges(ParticipantDetail justi
};

// see if email has changed - case insensitive
if (!string.IsNullOrEmpty(justinUserInfo.emailAddress))
if (!this.JUSTIN_EMAIL_CHANGE_DISABLED)
{
if (string.IsNullOrEmpty(justinUserInfo.emailAddress))
{
Serilog.Log.Warning($"User {party.Id} email is null or empty in JUSTIN");
}
else if (!party.Email.Equals(justinUserInfo.emailAddress, StringComparison.OrdinalIgnoreCase))
if (!string.IsNullOrEmpty(justinUserInfo.emailAddress))
{
Serilog.Log.Information($"User {party.Id} email changed from {party.Email} to {justinUserInfo.emailAddress}");
userChangeModel.SingleChangeTypes.Add(ChangeType.EMAIL, new SingleChangeType(party.Email, justinUserInfo.emailAddress));
if (string.IsNullOrEmpty(justinUserInfo.emailAddress))
{
Serilog.Log.Warning($"User {party.Id} email is null or empty in JUSTIN");
}
else if (!party.Email.Equals(justinUserInfo.emailAddress, StringComparison.OrdinalIgnoreCase))
{
Serilog.Log.Information($"User {party.Id} email changed from {party.Email} to {justinUserInfo.emailAddress}");
userChangeModel.SingleChangeTypes.Add(ChangeType.EMAIL, new SingleChangeType(party.Email, justinUserInfo.emailAddress));
}
}
}

Expand Down
8 changes: 6 additions & 2 deletions backend/webapi/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ namespace Pidp;
using Pidp.Models.Lookups;
using static Pidp.Models.Lookups.CourtLocation;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Authorization;

public class Startup
{
Expand Down Expand Up @@ -302,7 +304,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
);// "/error");

app.UseSwagger();
app.UseSwaggerUI(options => options.SwaggerEndpoint("/swagger/v1/swagger.json", "PIdP Web API"));
app.UseSwaggerUI(options => options.SwaggerEndpoint("/swagger/v1/swagger.json", "DIAM Web API"));

app.UseSerilogRequestLogging(options => options.EnrichDiagnosticContext = (diagnosticContext, httpContext) =>
{
Expand All @@ -327,8 +329,10 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
endpoints.MapControllers();
endpoints.MapMetrics();
endpoints.MapHealthChecks("/health/liveness").AllowAnonymous();
endpoints.MapHealthChecks("/health/liveness", new HealthCheckOptions { AllowCachingResponses = false }).WithMetadata(new AllowAnonymousAttribute());
});




Expand Down
Binary file modified charts/pidp/charts/edt-casemgmt-0.1.0.tgz
Binary file not shown.
Binary file modified charts/pidp/charts/edt-disclosure-0.1.0.tgz
Binary file not shown.
Binary file modified charts/pidp/charts/edt-service-0.1.3.tgz
Binary file not shown.
Binary file modified charts/pidp/charts/frontend-0.1.2.tgz
Binary file not shown.
Binary file modified charts/pidp/charts/jum-backend-0.1.2.tgz
Binary file not shown.
Binary file modified charts/pidp/charts/jum-notification-0.1.2.tgz
Binary file not shown.
Binary file modified charts/pidp/charts/nginx-9.7.3.tgz
Binary file not shown.
Binary file modified charts/pidp/charts/plr-intake-0.1.2.tgz
Binary file not shown.
Binary file modified charts/pidp/charts/webapi-0.1.9.tgz
Binary file not shown.
2 changes: 2 additions & 0 deletions charts/webapi/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ spec:
secretKeyRef:
name: splunk-config
key: SplunkConfig__Host
- name: JUSTIN_EMAIL_CHANGE_DISABLED
value: "true"
volumeMounts:
- name: kafka-truststore
mountPath: "/opt/kafka/certificates"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<ui-page-section>
<ui-page-section-subheader icon="history" heading="Requests">
<ng-container uiPageSectionSubheaderDesc>
This is a log of your interactions with the Provider
Identity Portal.
This is a log of your interactions with the Digital Identity Access Management portal.
</ng-container>
</ui-page-section-subheader>

Expand Down

0 comments on commit f835885

Please sign in to comment.