Skip to content

Commit

Permalink
Merge pull request #296 from Blazam-App/0.9.1-Gen
Browse files Browse the repository at this point in the history
Fix for Changed Entries timezone being UTC
  • Loading branch information
jacobsen9026 authored Apr 12, 2024
2 parents 4ad9be4 + 83f8d7f commit 1ceca62
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 84 deletions.
4 changes: 2 additions & 2 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.9.0</AssemblyVersion>
<Version>2024.04.12.2206</Version>
<AssemblyVersion>0.9.1</AssemblyVersion>
<Version>2024.04.12.2311</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<RootNamespace>BLAZAM</RootNamespace>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
Expand Down
7 changes: 6 additions & 1 deletion BLAZAMCommon/Helpers/NetworkTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ public static bool PingHost(string hostNameOrAddress)
}
return pingable;
}

/// <summary>
/// Checks if the following TCP port is currently open and reachable by the host machine
/// </summary>
/// <param name="hostNameOrAddress">The hostname, FQDN, or IP of the host to check</param>
/// <param name="port">The port number to check</param>
/// <returns>True if the port is open, otherwise false</returns>
public static bool IsPortOpen(string hostNameOrAddress, int port)
{
return IsAnyPortOpen(hostNameOrAddress, new int[] { port });
Expand Down
9 changes: 8 additions & 1 deletion BLAZAMGui/UI/Dashboard/Widgets/ChangedEntriesWidget.razor
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@
</MudTooltip>
</CellTemplate>
</TemplateColumn>
<PropertyColumn Property="x=>x.LastChanged" Title="Changed" />
<TemplateColumn Title=@AppLocalization["Changed"]>
<CellTemplate>
@if (context.Item?.LastChanged != null)
{
<MudText>@context.Item.LastChanged?.ToLocalTime()</MudText>
}
</CellTemplate>
</TemplateColumn>

</Columns>
<PagerContent>
Expand Down
94 changes: 46 additions & 48 deletions BLAZAMGui/UI/DirectoryEntryViewHeader.razor
Original file line number Diff line number Diff line change
Expand Up @@ -56,82 +56,80 @@
}


@if (DirectoryEntry.CanEdit)
{
<MudTooltip Text="@AppLocalization["Edit"]">

<MudToggleIconButton Toggled=EditMode
ToggledChanged="@(async(state)=>{await ToggleEditMode(state);})"
Icon="@Icons.Material.Filled.Edit"
ToggledIcon="@Icons.Material.Filled.EditOff"
ToggledColor="Color.Error"
ToggledTitle="End Edit" />
</MudTooltip>
}
@if (accountEntry != null && accountEntry.LockedOut && accountEntry.CanUnlock)

<MudTooltip Text="@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)
ToggledTitle="End Edit" />
</MudTooltip>

@if (accountEntry != null && accountEntry.LockedOut)
{
<MudTooltip Text="@AppLocalization["Unlock"]">

<MudIconButton OnClick="Unlock"
Icon="@Icons.Material.Filled.LockOpen"
Disabled=@(!accountEntry.CanUnlock)
aria-label="unlock" />
</MudTooltip>
}
@if (groupableEntry?.CanAssign == true)
@if (groupableEntry != null)
{
<MudTooltip Text="@AppLocalization["Assign To"]">

<MudIconButton OnClick="@Assign"
Disabled=@(!groupableEntry.CanAssign)
Icon="@Icons.Material.Filled.GroupAdd"
aria-label="assign to" />
</MudTooltip>

}
@if (accountEntry?.CanDisable == true && accountEntry is not IADComputer)
@if (accountEntry != null && accountEntry is not IADComputer)
{
<MudTooltip Text="@AppLocalization["Change Password"]">
<MudIconButton OnClick="@ResetPassword"
Disabled=@(!accountEntry.CanDisable)
Icon="@Icons.Material.Filled.Password"
aria-label="change password" />
</MudTooltip>
}
@if (DirectoryEntry.CanRename)
{
<MudTooltip Text="@AppLocalization["Rename"]">
<MudTooltip Text="@AppLocalization["Rename"]">

<MudIconButton OnClick="@Rename"
Icon="@Icons.Material.Filled.DriveFileRenameOutline"
aria-label="rename" />
<MudIconButton OnClick="@Rename"
Disabled=@(!DirectoryEntry.CanRename)
Icon="@Icons.Material.Filled.DriveFileRenameOutline"
aria-label="rename" />

</MudTooltip>
}
@if (DirectoryEntry.CanMove)
{
<MudTooltip Text="@AppLocalization["Move"]">
</MudTooltip>

<MudIconButton OnClick="@Move"
Icon="@Icons.Material.Filled.DriveFileMove"
aria-label="move" />
</MudTooltip>
}
@if (DirectoryEntry.CanDelete)
{
<MudTooltip Text="@AppLocalization["Delete"]">
<MudTooltip Text="@AppLocalization["Move"]">

<MudIconButton OnClick="@Move"
Disabled=@(!DirectoryEntry.CanMove)
Icon="@Icons.Material.Filled.DriveFileMove"
aria-label="move" />
</MudTooltip>
<MudTooltip Text="@AppLocalization["Delete"]">

<MudIconButton OnClick="@DeleteUser"
Color="Color.Error"
Disabled=@(!DirectoryEntry.CanDelete)
Icon="@Icons.Material.Filled.Delete"
aria-label="change password" />
</MudTooltip>

<MudTooltip Text="@AppLocalization["Change History"]">
<MudIconButton OnClick="@ShowHistory"
Disabled=@(!DirectoryEntry.CanEdit)
Icon="@Icons.Material.Filled.History" />
</MudTooltip>

<MudIconButton OnClick="@DeleteUser"
Color="Color.Error"
Icon="@Icons.Material.Filled.Delete"
aria-label="change password" />
</MudTooltip>
}
@if (DirectoryEntry.CanEdit)
{
<MudTooltip Text="@AppLocalization["Change History"]">
<MudIconButton OnClick="@ShowHistory"
Icon="@Icons.Material.Filled.History" />
</MudTooltip>

}

<MudTooltip Text="@(IsFavorite==true?AppLocalization["Remove from favorites"]:AppLocalization["Add to favorites"])">
<MudIconButton OnClick="@ToggleFavorite"
Expand All @@ -145,7 +143,7 @@
<MudHidden Breakpoint="Breakpoint.MdAndUp">

<MudMenu Class="align-self-end"
IconColor="@Color.Surface"
IconColor="@Color.Surface"
StartIcon="@Icons.Material.Filled.Settings">
@if (accountEntry != null)
{
Expand Down
82 changes: 51 additions & 31 deletions BLAZAMGui/UI/Groups/AssignToModalContent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,56 @@

<MudStack Row=true>
<MudStack>
<ADAutoComplete Class=""
Disabled=@(copyFrom!=null)
Label="Group Name"
SearchObjectType="ActiveDirectoryObjectType.Group"
@bind-SelectedResult=@Group
CustomResultsFilter=@((result)=>{
if(result is IADGroup){
return !DirectoryModel.MemberOf.Contains(result as IADGroup);
}
return true;
}) />
@foreach (var group in additionalGroups)
{

<MudStack Row=true>
@{
var count = additionalGroups.Count;
var x = 1;

<ADAutoComplete Class=""
}
<MudStack Row=true>
<ADAutoComplete Class=""
Disabled=@(copyFrom!=null)
Label="Group Name"
SearchObjectType="ActiveDirectoryObjectType.Group"
SelectedResult=@group.Value
SelectedResultChanged="@((newValue)=>{additionalGroups[group.Key]=newValue;})"/>

<MudIconButton Icon=@Icons.Material.Filled.Delete OnClick=@(()=>{additionalGroups.Remove(group.Key);}) />

</MudStack>


@bind-SelectedResult=@Group
CustomResultsFilter=@((result)=>{
if(result is IADGroup){
return !DirectoryModel.MemberOf.Contains(result as IADGroup);
}
return true;
}) />
@if (count == 0)
{
<MudIconButton Icon=@Icons.Material.Filled.PlusOne OnClick=@AddGroupInput />
}

</MudStack>

@foreach (var group in additionalGroups)
{

<MudStack Row=true>

<ADAutoComplete Class=""
Disabled=@(copyFrom!=null)
Label="Group Name"
SearchObjectType="ActiveDirectoryObjectType.Group"
SelectedResult=@group.Value
SelectedResultChanged="@((newValue)=>{additionalGroups[group.Key]=newValue;})" />


<MudIconButton Icon=@Icons.Material.Filled.Delete OnClick=@(()=>{additionalGroups.Remove(group.Key);}) />
@{
if (count == x)
{
<MudIconButton Icon=@Icons.Material.Filled.PlusOne OnClick=@AddGroupInput />

}
x++;

}
</MudStack>

}
<MudIconButton Icon=@Icons.Material.Filled.PlusOne OnClick=@AddGroupInput />
<MudText Class="my-3" Align="Align.Center">@AppLocalization["or"]</MudText>
<ADAutoComplete Disabled=@(Group!=null)
Label="Copy Memberships From"
Expand Down Expand Up @@ -96,7 +116,7 @@

@code {

#nullable disable warnings
#nullable disable warnings
[Parameter]
public EventCallback<GroupMembershipChange> OnGroupMembershipChange { get; set; }

Expand All @@ -106,7 +126,7 @@
[Parameter]
public IGroupableDirectoryAdapter DirectoryModel { get; set; }

private Dictionary<int,IDirectoryEntryAdapter?> additionalGroups = new Dictionary<int,IDirectoryEntryAdapter?>();
private Dictionary<int, IDirectoryEntryAdapter?> additionalGroups = new Dictionary<int, IDirectoryEntryAdapter?>();
protected override void OnInitialized()
{
base.OnInitialized();
Expand All @@ -123,7 +143,7 @@
new IDirectoryEntryAdapter Group { get; set; }
async void AddGroupInput()
{
additionalGroups.Add(additionalGroups.Count,null);
additionalGroups.Add(additionalGroups.Count, null);
await InvokeAsync(StateHasChanged);
}
async void AssignToGroup()
Expand All @@ -134,10 +154,10 @@
DirectoryModel.AssignTo(group);
if (additionalGroups.Count > 0)
{
foreach(var g in additionalGroups)
foreach (var g in additionalGroups)
{
if(g.Value is IADGroup gr)
DirectoryModel.AssignTo(gr);
if (g.Value is IADGroup gr)
DirectoryModel.AssignTo(gr);
}
}
SnackBarService.Warning(DirectoryModel.CanonicalName + " has been assigned to the selected group(s) but changes must be saved.");
Expand Down
11 changes: 10 additions & 1 deletion BLAZAMGui/UI/Outputs/StatusCheck.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@


@if (Text.IsNullOrEmpty())
{
<MudAvatar Size="Size.Small" Color="@Color" Variant="Variant.Filled">
<MudIcon Icon="@Icon"/>
</MudAvatar>
}
else
{
<MudChip Color=@Color Icon="@Icon">@Text</MudChip>

<MudChip Color=@Color Icon="@Icon" >@Text</MudChip>
}

@code {
[Parameter]
Expand Down

0 comments on commit 1ceca62

Please sign in to comment.