Skip to content

Commit

Permalink
Merge pull request #281 from Blazam-App/Beta-Nightly
Browse files Browse the repository at this point in the history
v0.9 Update
  • Loading branch information
jacobsen9026 authored Mar 30, 2024
2 parents 7a7b998 + ba4a63c commit 730038f
Show file tree
Hide file tree
Showing 192 changed files with 2,610 additions and 7,362 deletions.
2 changes: 1 addition & 1 deletion BLAZAM.Tests/BLAZAM.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.1">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
33 changes: 17 additions & 16 deletions BLAZAM/BLAZAM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ServerGarbageCollection>false</ServerGarbageCollection>
<AssemblyVersion>0.8.9</AssemblyVersion>
<Version>2024.02.27.2343</Version>
<AssemblyVersion>0.9.0</AssemblyVersion>
<Version>2024.03.30.1734</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<RootNamespace>BLAZAM</RootNamespace>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
Expand All @@ -28,6 +28,8 @@
<None Remove="static\img\default_logo4.png" />
</ItemGroup>






Expand All @@ -53,36 +55,35 @@
<ItemGroup>
<PackageReference Include="BlazorTemplater" Version="1.5.1" />
<PackageReference Include="Cassia" Version="2.0.0.60" />
<PackageReference Include="Core.System.Configuration.Install" Version="1.1.0" />
<PackageReference Include="DuoUniversal" Version="1.2.2" />
<PackageReference Include="MailKit" Version="4.3.0" />
<PackageReference Include="MailKit" Version="4.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.27" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.27" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.27" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.28" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.28" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.28" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.27" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="7.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.16">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.17" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="7.0.17" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.17" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.17" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.17" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.17">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.16" />
<PackageReference Include="MudBlazor.Markdown" Version="0.1.3" />
<PackageReference Include="MudBlazor.ThemeManager" Version="1.0.8" />
<PackageReference Include="MudBlazor.ThemeManager" Version="1.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Octokit" Version="10.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.0" />
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.1" />
<PackageReference Include="System.DirectoryServices" Version="8.0.0" />

<PackageReference Include="System.DirectoryServices.AccountManagement" Version="8.0.0" />
Expand Down
43 changes: 35 additions & 8 deletions BLAZAM/Pages/Benchmark.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@inject IAppDatabaseFactory factory
@inject IActiveDirectoryContextFactory directoryFactory
@inherits AppComponentBase
@page "/benchmark"

@inject IActiveDirectoryContext Dir

<h3>Benchmark</h3>
<p>Number of cycles</p>
Expand All @@ -15,18 +16,41 @@

<p>User Bench</p>
<p>email: @userBench?.SamAccountName</p>








@*
<h3>Tree View</h3>
<MudSwitch @bind-Value=adTree Label="OU/AD"/>
@if (!adTree)
{
<OUTreeView StartRootExpanded=true
EndText="@((context)=>context.DirectPermissionMappings.Any()?context.DirectPermissionMappings.Count().ToString():null)" />
}
else
{
<ADTreeView TextColor="Color.Surface" EndText="@((context)=>context is IADOrganizationalUnit ou?ou.DirectPermissionMappings.Any()?ou.DirectPermissionMappings.Count().ToString():null:null)" />
} *@
@code {
#nullable disable warnings
#nullable disable warnings
ActiveDirectoryContext ad;
bool Running = false;
int runCount;
bool adTree;
int runCount = 1;
int cycle;
double elapsed;
double elapsed2;
IADUser userBench;
protected override void OnInitialized()
{
// ad = new ActiveDirectory(factory, true);
// ad = new ActiveDirectory(factory, true);
}
async Task Benchmark1()
{
Expand All @@ -39,8 +63,9 @@
for (cycle = 0; cycle < runCount; cycle++)
{
DateTime start = DateTime.Now;
var dir = Directory as ActiveDirectoryContext;


var user = dir.Authenticate(new() { Username = "johnsoncontrols", Password = "bburg123" });
runs[cycle] = (DateTime.Now - start).TotalSeconds;
InvokeAsync(StateHasChanged);

Expand All @@ -61,7 +86,7 @@
Random r = new Random();

userBench = dir.Users.FindUsersByString("c").First();
if (userBench==null) result = false;
if (userBench == null) result = false;
else result = true;

dir.Dispose();
Expand All @@ -79,9 +104,11 @@

DateTime start = DateTime.Now;

Dir.Users.FindUsersByString("cja");
var dir = Directory as ActiveDirectoryContext;
var user = dir.Authenticate_Alt(new() { Username = "johnsoncontrols", Password = "bburg123" });

runs[cycle] = (DateTime.Now - start).TotalSeconds;

InvokeAsync(StateHasChanged);

}
Expand Down
23 changes: 17 additions & 6 deletions BLAZAM/Pages/Browse/Browse.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,31 @@
<h3>Browse</h3>
@if (Monitor.DirectoryConnectionStatus == ServiceConnectionState.Up)
{
<MudContainer Style=" position:relative;">
<MudDrawerContainer>
<MudDrawer Anchor="Anchor.End"
Style="min-height:200px"
Variant=DrawerVariant.Persistent
@bind-Open=_drawerOpen>

<ADTreeView TextColor="Color.Surface" @bind-SelectedEntry=selectedEntry />

<ADTreeView @bind-SelectedOU=selectedEntry/>
@if (selectedEntry != null && selectedEntry is not IADOrganizationalUnit)
{
<ViewDirectoryEntry DirectoryEntry="selectedEntry" />

}
</MudDrawer>
@if (selectedEntry != null && selectedEntry is not IADOrganizationalUnit)
{
<ViewDirectoryEntry DirectoryEntry="selectedEntry" />

}
</MudDrawerContainer>

</MudContainer>

}
@code {

IDirectoryEntryAdapter? selectedEntry;

bool _drawerOpen = true;
protected override void OnInitialized()
{
base.OnInitialized();
Expand Down
4 changes: 2 additions & 2 deletions BLAZAM/Pages/Browse/ViewDirectoryEntry.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@inject IStringLocalizer<AppLocalization> AppLocalization
<CascadingValue Value="ChangeHistoryModal">
@switch (DirectoryEntry.ObjectType)
@switch (DirectoryEntry?.ObjectType)
{
case ActiveDirectoryObjectType.User:
<ViewUser DirectoryEntry="DirectoryEntry" />
Expand Down Expand Up @@ -31,5 +31,5 @@
[Parameter]
public IDirectoryEntryAdapter? DirectoryEntry { get; set; }

protected AppModal ChangeHistoryModal{ get; set; }
protected AppModal? ChangeHistoryModal{ get; set; }
}
12 changes: 6 additions & 6 deletions BLAZAM/Pages/Computers/ViewComputer.razor
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
OnResetPassword="@(()=>{ChangePasswordModal?.Show();})"
OnToggleEditMode="ToggleEditMode"
OnUnlock="@Unlock"
OnShowHistory="@(()=>{ChangeHistoryModal.Show();})"/>
OnShowHistory="@(()=>{ChangeHistoryModal?.Show();})"/>
<MudOverlay Visible="SavingChanges" DarkBackground="false" Absolute="true">

</MudOverlay>
Expand Down Expand Up @@ -252,15 +252,15 @@

async Task Unlock()
{
if (await MessageService.Confirm("Are you sure you want to unlock " + Computer?.CanonicalName + "?", "Unlock Computer"))
if (Computer!=null && await MessageService.Confirm("Are you sure you want to unlock " + Computer?.CanonicalName + "?", "Unlock Computer"))
{
Computer.LockedOut = false;
}

}
protected override async void DiscardChanges()
{
if (await MessageService.Confirm("Are you sure you want to discard your changes?", "Discard Changes"))
if (Computer != null && await MessageService.Confirm("Are you sure you want to discard your changes?", "Discard Changes"))
{
Computer.DiscardChanges();
EditMode = false;
Expand All @@ -271,7 +271,7 @@
}
async Task DeleteComputer()
{
if (await MessageService.Confirm("Are you sure you want to delete " + Computer?.CanonicalName + "?", "Delete Computer"))
if (Computer != null && await MessageService.Confirm("Are you sure you want to delete " + Computer?.CanonicalName + "?", "Delete Computer"))
{
try
{
Expand All @@ -290,7 +290,7 @@
}
async void SaveChanges()
{
if (await MessageService.Confirm("Are you sure you want to save the changes?"))
if (Computer != null && await MessageService.Confirm("Are you sure you want to save the changes?"))
{
var jobResults = await Computer.CommitChangesAsync();
if (jobResults.Result == JobResult.Passed)
Expand All @@ -305,7 +305,7 @@
}
else
{
jobResults.ShowJobDetailsDialog(MessageService);
await jobResults.ShowJobDetailsDialogAsync(MessageService);
}


Expand Down
4 changes: 2 additions & 2 deletions BLAZAM/Pages/Configure/AddFieldModalContent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
protected override void OnInitialized()
{
base.OnInitialized();
Modal.OnYes = Add;
Modal.YesText = AppLocalization["Add"];
Modal.SetOnYes(Add);
Modal.SetYesText(AppLocalization["Add"]);
foreach(var objectType in Enum.GetValues<ActiveDirectoryObjectType>().Where(ot=>ot!=ActiveDirectoryObjectType.All))
{
assignedObjectTypes.Add(objectType.ToString(), false);
Expand Down
50 changes: 29 additions & 21 deletions BLAZAM/Pages/Configure/Audit.razor
Original file line number Diff line number Diff line change
Expand Up @@ -85,27 +85,35 @@
</MudTabPanel>
<MudTabPanel>
<ChildContent>
<MudDataGrid Virtualize=true
Height="600px"
ColumnResizeMode="ResizeMode.Container"
FixedHeader=true
Hideable=true
Items="@systemAuditEntries.OrderByDescending(ae=>ae.Timestamp)"
Filterable="false"
SortMode="@SortMode.Multiple"
Groupable="false">
<Columns>
<PropertyColumn Property="x => x.Timestamp.ToLocalTime()" />
<PropertyColumn Property="x => x.Username" />
<PropertyColumn Property="x => x.IpAddress" />
<PropertyColumn Property="x => x.Target" />

<PropertyColumn Property="x => x.Target" />
<PropertyColumn Property="x => x.BeforeAction" />
<PropertyColumn Property="x => x.AfterAction" />

</Columns>
</MudDataGrid>
@if(ApplicationInfo.InDemoMode && CurrentUser.Username == "Demo")
{
<MudText>Disabled in demo</MudText>
}
else
{
<MudDataGrid Virtualize=true
Height="600px"
ColumnResizeMode="ResizeMode.Container"
FixedHeader=true
Hideable=true
Items="@systemAuditEntries.OrderByDescending(ae=>ae.Timestamp)"
Filterable="false"
SortMode="@SortMode.Multiple"
Groupable="false">
<Columns>
<PropertyColumn Property="x => x.Timestamp.ToLocalTime()" />
<PropertyColumn Property="x => x.Username" />
<PropertyColumn Property="x => x.IpAddress" />
<PropertyColumn Property="x => x.Target" />

<PropertyColumn Property="x => x.Target" />
<PropertyColumn Property="x => x.BeforeAction" />
<PropertyColumn Property="x => x.AfterAction" />

</Columns>
</MudDataGrid>
}




Expand Down
7 changes: 5 additions & 2 deletions BLAZAM/Pages/Configure/Fields.razor
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@
{
LoadingData = true;
await InvokeAsync(StateHasChanged);
ADFields = await Context.CustomActiveDirectoryFields.Where(x => x.DeletedAt == null).ToListAsync();
if (Context != null)
{
ADFields = await Context.CustomActiveDirectoryFields.Where(x => x.DeletedAt == null).ToListAsync();
}
LoadingData = false;
var data = new GridData<CustomActiveDirectoryField>();
data.Items = ADFields;
Expand All @@ -104,7 +107,7 @@
if (await MessageService.Confirm("Are you sure you want to delete " + field.DisplayName + "?", "Delete " + field.DisplayName + "?"))
{
field.DeletedAt = DateTime.UtcNow;
if (await Context.SaveChangesAsync() > 0)
if (Context != null && await Context.SaveChangesAsync() > 0)
{
await fieldGrid?.ReloadServerData();

Expand Down
Loading

0 comments on commit 730038f

Please sign in to comment.