Skip to content

Commit

Permalink
Merge pull request #701 from Blazam-App/v1-Nightly
Browse files Browse the repository at this point in the history
Maggie update
  • Loading branch information
jacobsen9026 authored Dec 14, 2024
2 parents 5d5f0df + fd6f7d3 commit 9ddfb68
Show file tree
Hide file tree
Showing 57 changed files with 734 additions and 318 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "7.0.1",
"version": "9.0.0",
"commands": [
"dotnet-ef"
]
Expand Down
19 changes: 11 additions & 8 deletions BLAZAM/BLAZAM.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ServerGarbageCollection>false</ServerGarbageCollection>
<AssemblyVersion>1.2.1</AssemblyVersion>
<Version>2024.12.02.2252</Version>
<AssemblyVersion>1.2.2</AssemblyVersion>
<Version>2024.12.14.0307</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<RootNamespace>BLAZAM</RootNamespace>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
Expand Down Expand Up @@ -64,19 +64,19 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.11" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.7" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" />
<PackageReference Include="MudBlazor" Version="7.15.0" />
<PackageReference Include="MudBlazor.Markdown" Version="7.14.0" />
<PackageReference Include="MudBlazor.ThemeManager" Version="2.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Polly.Contrib.WaitAndRetry" Version="1.1.1" />
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="7.1.0" />
<PackageReference Include="System.DirectoryServices" Version="9.0.0" />

Expand Down Expand Up @@ -126,6 +126,9 @@
<Content Update="wwwroot\favicon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\jira\feature-request.html">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 10 additions & 1 deletion BLAZAM/Pages/API/v1/Templates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using BLAZAM.Services.Audit;
using BLAZAM.Session.Interfaces;
using System.Text.Json;
using BLAZAM.Common.Data.Database;

namespace BLAZAM.Pages.API.v1
{
Expand Down Expand Up @@ -173,8 +174,16 @@ public async Task<IActionResult> Execute(int templateId, [FromBody] NewUserDetai
{
newUser = (IADUser)Directory.GetDirectoryEntryByDN(newUser.DN);
await AuditLogger.User.Created(newUser);
if (DbFactory.DatabaseType == DatabaseType.SQLite)
{
await OUNotificationService.PostAsync(newUser, NotificationType.Create, CurrentUserState);

_ = OUNotificationService.PostAsync(newUser, NotificationType.Create, CurrentUserState);
}
else
{
_ = OUNotificationService.PostAsync(newUser, NotificationType.Create, CurrentUserState);

}

try
{
Expand Down
31 changes: 30 additions & 1 deletion BLAZAM/Pages/Computers/ViewComputer.razor
Original file line number Diff line number Diff line change
Expand Up @@ -325,17 +325,46 @@
{
await AuditLogger.Computer.Assigned(assignment.Member, assignment.Group);
await AuditLogger.Group.MemberAdded(assignment.Group, assignment.Member);
if (DbFactory.DatabaseType == DatabaseType.SQLite)
{
await NotificationGenerationService.PostAsync(Computer, NotificationType.Assign, CurrentUser.State, assignment.Group);

}
else
{
_ = NotificationGenerationService.PostAsync(Computer, NotificationType.Assign, CurrentUser.State, assignment.Group);

}
}

foreach (var assignment in unassignFrom)
{
await AuditLogger.Computer.Unassigned(assignment.Member, assignment.Group);
await AuditLogger.Group.MemberRemoved(assignment.Group, assignment.Member);
if (DbFactory.DatabaseType == DatabaseType.SQLite)
{
await NotificationGenerationService.PostAsync(Computer, NotificationType.Unassign, CurrentUser.State, assignment.Group);

}
else
{
_ = NotificationGenerationService.PostAsync(Computer, NotificationType.Unassign, CurrentUser.State, assignment.Group);

}
}
if (changes.Any(c => c.Field != ActiveDirectoryFields.MemberOf.FieldName))
{
_ = NotificationGenerationService.PostAsync(Computer, NotificationType.Modify, CurrentUser.State);
await AuditLogger.User.Changed(Computer, changes.Where(c => c.Field != ActiveDirectoryFields.MemberOf.FieldName).ToList());
if (DbFactory.DatabaseType == DatabaseType.SQLite)
{
await NotificationGenerationService.PostAsync(Computer, NotificationType.Modify, CurrentUser.State);

}
else
{
_ = NotificationGenerationService.PostAsync(Computer, NotificationType.Modify, CurrentUser.State);

}
}


Expand Down
11 changes: 5 additions & 6 deletions BLAZAM/Pages/Configure/Audit.razor
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,12 @@
</MudText>
</CellTemplate>
</TemplateColumn>
<PropertyColumn Property="x => x.Username" />
<PropertyColumn Property="x => x.IpAddress" />
<PropertyColumn Property="x => x.Target" />
<PropertyColumn Property="x => x.Username" Title="@AppLocalization["Username"]"/>
<PropertyColumn Property="x => x.IpAddress" Title="@AppLocalization["IP Address"]" />
<PropertyColumn Property="x => x.Target" Title="@AppLocalization["Target"]" />

<PropertyColumn Property="x => x.Target" />
<PropertyColumn Property="x => x.BeforeAction" />
<PropertyColumn Property="x => x.AfterAction" />
<PropertyColumn Property="x => x.BeforeAction" Title="@AppLocalization["Before Action"]" />
<PropertyColumn Property="x => x.AfterAction" Title="@AppLocalization["After Action"]" />

</Columns>
</MudDataGrid>
Expand Down
23 changes: 17 additions & 6 deletions BLAZAM/Pages/Configure/Fields.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,22 @@
EditTrigger="DataGridEditTrigger.Manual">
<ToolBarContent>
<MudSpacer />
<MudIconButton Icon="@Icons.Material.Filled.Add" Color=@Color.Success OnClick="@(()=>{addFieldModal?.ShowAsync();})" />
<MudIconButton Icon="@Icons.Material.Filled.Add"
Color=@Color.Success
OnClick="@(()=>{addFieldModal?.ShowAsync();})" />

</ToolBarContent>

<Columns>

<TemplateColumn Context="cellContext" CellClass="d-flex justify-end" Title="Edit" Sortable="false">
<TemplateColumn Context="cellContext"
CellClass="d-flex justify-end"
Title=@AppLocalization["Edit"]
Sortable="false">
<CellTemplate>
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Edit" OnClick="@cellContext.Actions.StartEditingItemAsync" />
<MudIconButton Size="@Size.Small"
Icon="@Icons.Material.Outlined.Edit"
OnClick="@cellContext.Actions.StartEditingItemAsync" />
</CellTemplate>
</TemplateColumn>

Expand All @@ -38,7 +45,8 @@
<TemplateColumn Title=@AppLocalization["Field Type"]
Sortable="true">
<EditTemplate>
<FieldTypeSelect Variant="@Variant.Outlined" @bind-Value=context.Item.FieldType />
<FieldTypeSelect Variant="@Variant.Outlined"
@bind-Value=context.Item.FieldType />

</EditTemplate>
<CellTemplate>
Expand Down Expand Up @@ -66,7 +74,9 @@
</CellTemplate>
</TemplateColumn>
}
<TemplateColumn CellClass="d-flex justify-end" Title=@AppLocalization["Delete"] Sortable="false">
<TemplateColumn CellClass="d-flex justify-end"
Title=@AppLocalization["Delete"]
Sortable="false">
<CellTemplate>
<MudIconButton Disabled=@(context.Item.Id>100000)
Size="@Size.Small"
Expand All @@ -77,7 +87,8 @@
</Columns>
</MudDataGrid>

<AppModal @ref=addFieldModal Title="Add Field">
<AppModal @ref=addFieldModal
Title="Add Field">
<AddFieldModalContent FieldCreated="FieldCreated" />
</AppModal>
@code {
Expand Down
18 changes: 12 additions & 6 deletions BLAZAM/Pages/Configure/LoginHistoryChart.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
ChartOptions="@ChartOptions"></MudChart>
@*
<MudFab Icon="@Icons.Material.Filled.ShowChart" OnClick="ToggleLineMode" />*@
@code{
@code {



[Parameter]
public ChartOptions ChartOptions { get; set; } = new() { InterpolationOption=InterpolationOption.Straight };
public ChartOptions ChartOptions { get; set; } = new()
{
InterpolationOption = InterpolationOption.Straight
};


[Parameter]
public DateTime EndDate { get; set; } = DateTime.Today;

Expand Down Expand Up @@ -40,13 +45,14 @@
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();

var startDate = EndDate.AddDays(-1*Days);
loginChart = new() { Name = AppLocalization["Daily Logins"] };
uniqueUsersChart = new() { Name = AppLocalization["Daily Users"] };
var startDate = EndDate.AddDays(-1 * Days);
allDates = Enumerable.Range(0, (int)(EndDate - startDate).TotalDays + 1)
.Select(d => startDate.AddDays(d));
using (var context = await DbFactory.CreateDbContextAsync())
{

logonEntries = await context.LogonAuditLog.ToListAsync();


Expand Down
28 changes: 19 additions & 9 deletions BLAZAM/Pages/Groups/ConfirmNewGroup.razor
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
@inherits AppComponentBase
@inject NotificationGenerationService OUNotificationService
@inject NotificationGenerationService NotificationGenerationService

<AppPageTitle>Confirm Group Creation</AppPageTitle>
<AppPageTitle>@AppLocalization["Confirm Group Creation"]</AppPageTitle>

@if (Group != null)
{
<MudCard>
@Group.ADSPath

</MudCard>
<MudButton Disabled=@disableCreateGroupButton Color=Color.Success OnClick="CommitChanges">Create...</MudButton>
<MudButton Disabled=@disableCreateGroupButton Color=Color.Success OnClick="CommitChanges">
@AppLocalization["Create"]
</MudButton>
}
@code {

#nullable disable warnings
#nullable disable warnings

private bool disableCreateGroupButton = false;

Expand All @@ -33,20 +35,28 @@
createGroupJob.StopOnFailedStep = true;
createGroupJob.ShowJobDetailsDialog(MessageService);
var result = await Group.CommitChangesAsync(createGroupJob);

disableCreateGroupButton = false;
await InvokeAsync(StateHasChanged);
if (result.FailedSteps.Count == 0)
{
Group = (IADGroup)Directory.GetDirectoryEntryByDN(Group.DN);

SnackBarService.Success("Group created");
SnackBarService.Success(AppLocalization["Group created"]);
await AuditLogger.Group.Created(Group);
_ = OUNotificationService.PostAsync(Group, NotificationType.Create, CurrentUser.State);
if (DbFactory.DatabaseType == DatabaseType.SQLite)
{
await NotificationGenerationService.PostAsync(Group, NotificationType.Create, CurrentUser.State);

}
else
{
_= NotificationGenerationService.PostAsync(Group, NotificationType.Create, CurrentUser.State);

}
await Confirmed.InvokeAsync(Group);
}

}
}
}
Loading

0 comments on commit 9ddfb68

Please sign in to comment.