Skip to content

Commit

Permalink
Merge pull request #520 from Blazam-App/v1-Nightly
Browse files Browse the repository at this point in the history
V1 nightly
  • Loading branch information
jacobsen9026 authored Aug 30, 2024
2 parents 3e51dda + 22c6e6c commit dc48e59
Show file tree
Hide file tree
Showing 37 changed files with 750 additions and 628 deletions.
2 changes: 1 addition & 1 deletion BLAZAM.Tests/BLAZAM.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
14 changes: 0 additions & 14 deletions BLAZAM.sln
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BLAZAMLocalization", "BLAZA
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BLAZAMServices", "BLAZAMServices\BLAZAMServices.csproj", "{294A1093-94F5-4088-BF26-06F5BF8E84C2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BLAZAMEmail", "BLAZAMEmail\BLAZAMEmail.csproj", "{9F4BB42E-61A6-4970-951C-883CAA0CA25D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BLAZAMEmailMessage", "BLAZAMEmailMessage\BLAZAMEmailMessage.csproj", "{FBA9638A-1A71-4587-AADD-1F133ACF8E1A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BLAZAMStatic", "BLAZAMStatic\BLAZAMStatic.csproj", "{FA69CB05-1C56-43CD-948B-28A6D8643713}"
Expand Down Expand Up @@ -228,18 +226,6 @@ Global
{294A1093-94F5-4088-BF26-06F5BF8E84C2}.Release|x64.Build.0 = Release|Any CPU
{294A1093-94F5-4088-BF26-06F5BF8E84C2}.Release|x86.ActiveCfg = Release|Any CPU
{294A1093-94F5-4088-BF26-06F5BF8E84C2}.Release|x86.Build.0 = Release|Any CPU
{9F4BB42E-61A6-4970-951C-883CAA0CA25D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9F4BB42E-61A6-4970-951C-883CAA0CA25D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F4BB42E-61A6-4970-951C-883CAA0CA25D}.Debug|x64.ActiveCfg = Debug|Any CPU
{9F4BB42E-61A6-4970-951C-883CAA0CA25D}.Debug|x64.Build.0 = Debug|Any CPU
{9F4BB42E-61A6-4970-951C-883CAA0CA25D}.Debug|x86.ActiveCfg = Debug|Any CPU
{9F4BB42E-61A6-4970-951C-883CAA0CA25D}.Debug|x86.Build.0 = Debug|Any CPU
{9F4BB42E-61A6-4970-951C-883CAA0CA25D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F4BB42E-61A6-4970-951C-883CAA0CA25D}.Release|Any CPU.Build.0 = Release|Any CPU
{9F4BB42E-61A6-4970-951C-883CAA0CA25D}.Release|x64.ActiveCfg = Release|Any CPU
{9F4BB42E-61A6-4970-951C-883CAA0CA25D}.Release|x64.Build.0 = Release|Any CPU
{9F4BB42E-61A6-4970-951C-883CAA0CA25D}.Release|x86.ActiveCfg = Release|Any CPU
{9F4BB42E-61A6-4970-951C-883CAA0CA25D}.Release|x86.Build.0 = Release|Any CPU
{FBA9638A-1A71-4587-AADD-1F133ACF8E1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FBA9638A-1A71-4587-AADD-1F133ACF8E1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FBA9638A-1A71-4587-AADD-1F133ACF8E1A}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down
3 changes: 1 addition & 2 deletions BLAZAM/BLAZAM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<ServerGarbageCollection>false</ServerGarbageCollection>
<AssemblyVersion>1.0.1</AssemblyVersion>
<Version>2024.08.22.2343</Version>
<Version>2024.08.30.2118</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<RootNamespace>BLAZAM</RootNamespace>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
Expand Down Expand Up @@ -92,7 +92,6 @@
<ProjectReference Include="..\BLAZAMCommon\BLAZAMCommon.csproj" />
<ProjectReference Include="..\BLAZAMDatabase\BLAZAMDatabase.csproj" />
<ProjectReference Include="..\BLAZAMEmailMessage\BLAZAMEmailMessage.csproj" />
<ProjectReference Include="..\BLAZAMEmail\BLAZAMEmail.csproj" />
<ProjectReference Include="..\BLAZAMFileSystem\BLAZAMFileSystem.csproj" />
<ProjectReference Include="..\BLAZAMGui\BLAZAMGui.csproj" />
<ProjectReference Include="..\BLAZAMJobs\BLAZAMJobs.csproj" />
Expand Down
50 changes: 27 additions & 23 deletions BLAZAM/Pages/Browse/ViewDirectoryEntry.razor
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
@inject IStringLocalizer<AppLocalization> AppLocalization
<CascadingValue Value="ChangeHistoryModal">
@switch (DirectoryEntry?.ObjectType)
{
case ActiveDirectoryObjectType.User:
<ViewUser DirectoryEntry="DirectoryEntry" />
break;
case ActiveDirectoryObjectType.Group:
<ViewGroup DirectoryEntry="DirectoryEntry" />
break;
case ActiveDirectoryObjectType.Computer:
<ViewComputer DirectoryEntry="DirectoryEntry" />
break;
case ActiveDirectoryObjectType.OU:
<ViewOU DirectoryEntry="DirectoryEntry" />
break;
case ActiveDirectoryObjectType.Printer:
<ViewPrinter DirectoryEntry="DirectoryEntry" />
break;
case ActiveDirectoryObjectType.BitLocker:
<ViewBitLocker DirectoryEntry="DirectoryEntry" />
break;
}
@switch (DirectoryEntry?.ObjectType)
{
case ActiveDirectoryObjectType.User:
<ViewUser DirectoryEntry="DirectoryEntry" />
break;
case ActiveDirectoryObjectType.Group:
<ViewGroup DirectoryEntry="DirectoryEntry" />
break;
case ActiveDirectoryObjectType.Computer:
<ViewComputer DirectoryEntry="DirectoryEntry" />
break;
case ActiveDirectoryObjectType.OU:
<ViewOU DirectoryEntry="DirectoryEntry" />
break;
case ActiveDirectoryObjectType.Printer:
<ViewPrinter DirectoryEntry="DirectoryEntry" />
break;
case ActiveDirectoryObjectType.BitLocker:
<ViewBitLocker DirectoryEntry="DirectoryEntry" />
break;
}
</CascadingValue>
<AppModal Title=@AppLocalization["Change History"] @ref=@ChangeHistoryModal Options=@(new DialogOptions(){FullWidth=true,MaxWidth=MaxWidth.ExtraExtraLarge})>
<AppModal Title=@AppLocalization["Change History"]
@ref=@ChangeHistoryModal
Options=@(new DialogOptions(){FullWidth=true,
MaxWidth=MaxWidth.ExtraExtraLarge,
CloseButton=true})>
@if (ChangeHistoryModal?.IsShown == true)
{
<ChangeHistoryModalContent Model="DirectoryEntry" />
Expand All @@ -34,5 +38,5 @@
[Parameter]
public IDirectoryEntryAdapter? DirectoryEntry { get; set; }

protected AppModal? ChangeHistoryModal{ get; set; }
protected AppModal? ChangeHistoryModal { get; set; }
}
50 changes: 40 additions & 10 deletions BLAZAM/Pages/Computers/ViewComputer.razor
Original file line number Diff line number Diff line change
Expand Up @@ -300,24 +300,54 @@
{
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)
SavingChanges = true;
await RefreshEntryComponents();
try
{

var changes = Computer.Changes;
var assignTo = Computer.ToAssignTo;
var unassignFrom = Computer.ToUnassignFrom;
var jobResults = await Computer.CommitChangesAsync();
if (jobResults.Result == JobResult.Passed)
{
foreach (var assignment in assignTo)
{
await AuditLogger.Computer.Assigned(assignment.Member, assignment.Group);
await AuditLogger.Group.MemberAdded(assignment.Group, assignment.Member);
}

await AuditLogger.Computer.Changed(Computer, Computer.Changes);
_ = OUNotificationService.PostAsync(Computer, NotificationType.Modify);
foreach (var assignment in unassignFrom)
{
await AuditLogger.Computer.Unassigned(assignment.Member, assignment.Group);
await AuditLogger.Group.MemberRemoved(assignment.Group, assignment.Member);
}
if (changes.Any(c => c.Field != ActiveDirectoryFields.MemberOf.FieldName))
{
_ = OUNotificationService.PostAsync(Computer, NotificationType.Modify);
await AuditLogger.User.Changed(Computer, changes.Where(c => c.Field != ActiveDirectoryFields.MemberOf.FieldName).ToList());
}

EditMode = false;
Nav.WarnOnNavigation = false;
SnackBarService.Success("The changes made to this computer have been saved.");
await RefreshEntryComponents();


EditMode = false;
Nav.WarnOnNavigation = false;
SnackBarService.Success("The changes made to this computer have been saved.");
await RefreshEntryComponents();
}
else
{
await jobResults.ShowJobDetailsDialogAsync(MessageService);
}
}
else
catch (ApplicationException ex)
{
await jobResults.ShowJobDetailsDialogAsync(MessageService);
SnackBarService.Error(ex.Message);

}
SavingChanges = false;

await RefreshEntryComponents();

}
}
Expand Down
33 changes: 26 additions & 7 deletions BLAZAM/Pages/Groups/ViewGroup.razor
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,20 @@
</MudItem>
<MudItem xs="12" md="6">
<Section Style="min-height:200px;" Title=@AppLocalization["Parent Groups"]>
<MemberOfList Model="Group" />
<MemberOfList AssignToClicked=@AssignToModal.ShowAsync Model="Group" />

</Section>
</MudItem>


@if (Group.CanReadField(ActiveDirectoryFields.MemberOf))
{

<MudItem xs="12" md="12">
<Section Style="min-height:200px;" Title=@AppLocalization["Members"]>
<GroupMembersDataGrid Group="Group" />

</Section>
</MudItem>
}

</MudGrid>


Expand Down Expand Up @@ -150,12 +149,32 @@
if (await MessageService.Confirm("Are you sure you want to save the changes to " + Group.CanonicalName + "?", "Save Changes"))
{


var changes = Group.Changes;
var assignTo = Group.MembersToAdd;
var unassignFrom = Group.MembersToRemove;
var jobResults = await Group.CommitChangesAsync();
if (jobResults.Result == JobResult.Passed)
{
await AuditLogger.Group.Changed(Group, Group.Changes);

_ = OUNotificationService.PostAsync(Group, NotificationType.Modify);
foreach (var assignment in assignTo)
{
await AuditLogger.User.Assigned(assignment.Member, assignment.Group);
await AuditLogger.Group.MemberAdded(assignment.Group, assignment.Member);
}

foreach (var assignment in unassignFrom)
{
await AuditLogger.User.Unassigned(assignment.Member, assignment.Group);
await AuditLogger.Group.MemberRemoved(assignment.Group, assignment.Member);
}
if (changes.Any(c => c.Field != "member"))
{
_ = OUNotificationService.PostAsync(Group, NotificationType.Modify);
await AuditLogger.Group.Changed(Group, changes.Where(c => c.Field != ActiveDirectoryFields.MemberOf.FieldName).ToList());
}
//await AuditLogger.Group.Changed(Group, Group.Changes);
//_ = OUNotificationService.PostAsync(Group, NotificationType.Modify);
EditMode = false;
Nav.WarnOnNavigation = false;
Expand Down
25 changes: 9 additions & 16 deletions BLAZAM/Pages/Users/ViewUser.razor
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@
<LogonHoursModalContent User="User" />
}
</AppModal>

<MudGrid>
<MudItem xs="12" md="3">

<Section FullWidth=false>

<MudCard Elevation="2"
Style="width:fit-content;height:fit-content"
Class="relative mx-auto my-auto d-block p-1"
@onmouseenter=@(()=>{showRemoveThumbnail=true;})
@onmouseleave=@(()=>{showRemoveThumbnail=false;})>

@if (User?.ThumbnailPhoto != null)
{
<Base64Image Style="max-height:150px;max-width:150px;" Data="User.ThumbnailPhoto.ReizeRawImage(150)" />
Expand Down Expand Up @@ -165,19 +165,12 @@



@if (User.CanReadField(ActiveDirectoryFields.MemberOf))
{
<MudStack>
<MudText Typo="Typo.subtitle2">@AppLocalization["Groups"]</MudText>
<MemberOfList AssignToClicked=@(()=>{AssignToModal?.ShowAsync();}) Model="User" />

<MudStack>
<MudText Typo="Typo.subtitle2">@AppLocalization["Groups"]:</MudText>
<MemberOfList AssignToClicked=@(()=>{AssignToModal?.ShowAsync();}) Model="User" />
</MudStack>

</MudStack>
}
else
{
<NoAccess />
}
@if (User.Disabled)
{
<MudAlert Severity="Severity.Error" Class="mud-width-full">@AppLocalization["User is disabled"]</MudAlert>
Expand Down Expand Up @@ -465,7 +458,7 @@
</CascadingValue>

</EditForm>
@if (User.CanEdit && User.HasUnsavedChanges && !User.NewEntry)
@if ((User.CanEdit || CurrentUser.State.CanAssign) && User.HasUnsavedChanges && !User.NewEntry)
{
<UnsavedChangesPrompt SaveChanges="SaveChanges" DiscardChanges="DiscardChanges" />
}
Expand Down
4 changes: 2 additions & 2 deletions BLAZAMActiveDirectory/Adapters/ADGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace BLAZAM.ActiveDirectory.Adapters

public class ADGroup : GroupableDirectoryAdapter, IADGroup
{
protected List<GroupMembership> MembersToRemove = new List<GroupMembership>();
protected List<GroupMembership> MembersToAdd = new List<GroupMembership>();
public List<GroupMembership> MembersToRemove { get; private set; } = new List<GroupMembership>();
public List<GroupMembership> MembersToAdd { get; private set; } = new List<GroupMembership>();
public override string? DisplayName { get => base.CanonicalName; set => base.CanonicalName = value; }
public string? GroupName
{
Expand Down
5 changes: 4 additions & 1 deletion BLAZAMActiveDirectory/Interfaces/IADGroup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.DirectoryServices;
using BLAZAM.ActiveDirectory.Adapters;
using System.DirectoryServices;

namespace BLAZAM.ActiveDirectory.Interfaces
{
Expand All @@ -11,6 +12,8 @@ public interface IADGroup : IGroupableDirectoryAdapter, IComparable
List<IGroupableDirectoryAdapter> Members { get; }
List<string>? MembersAsStrings { get; }
IEnumerable<IGroupableDirectoryAdapter> NestedMembers { get; }
List<GroupMembership> MembersToRemove { get; }
List<GroupMembership> MembersToAdd { get; }

void AssignMember(IGroupableDirectoryAdapter member);
void UnassignMember(IGroupableDirectoryAdapter member);
Expand Down
2 changes: 1 addition & 1 deletion BLAZAMCommon.Tests/BLAZAMCommon.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
<PackageReference Include="System.Security.Permissions" Version="8.0.0" />
<PackageReference Include="xunit" Version="2.9.0" />
Expand Down
25 changes: 0 additions & 25 deletions BLAZAMEmail/BLAZAMEmail.csproj

This file was deleted.

1 change: 0 additions & 1 deletion BLAZAMGui/BLAZAMGui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

<ItemGroup>
<ProjectReference Include="..\BLAZAMCommon\BLAZAMCommon.csproj" />
<ProjectReference Include="..\BLAZAMEmail\BLAZAMEmail.csproj" />
<ProjectReference Include="..\BLAZAMLocalization\BLAZAMLocalization.csproj" />
<ProjectReference Include="..\BLAZAMLoggers\BLAZAMLogger.csproj" />
<ProjectReference Include="..\BLAZAMNav\BLAZAMNav.csproj" />
Expand Down
5 changes: 2 additions & 3 deletions BLAZAMGui/UI/DirectoryEntryViewHeader.razor
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,14 @@



<MudTooltip Text="@AppLocalization["Edit"]">
<MudTooltip Text="@(EditMode?AppLocalization["End Edit"]:AppLocalization["Edit"])">

<MudToggleIconButton Toggled=EditMode
ToggledChanged="@(async(state)=>{await ToggleEditMode(state);})"
Icon="@Icons.Material.Filled.Edit"
ToggledIcon="@Icons.Material.Filled.EditOff"
ToggledColor="Color.Error"
Disabled=@(!DirectoryEntry.CanEdit && (accountEntry!=null && (accountEntry.CanAssign||accountEntry.CanUnassign)))
ToggledTitle="End Edit" />
Disabled=@(!DirectoryEntry.CanEdit && (accountEntry!=null)) />

</MudTooltip>

Expand Down
Loading

0 comments on commit dc48e59

Please sign in to comment.