Skip to content

Commit

Permalink
Merge pull request #267 from Blazam-App/Beta-Dev
Browse files Browse the repository at this point in the history
Nightly Update
  • Loading branch information
jacobsen9026 authored Mar 20, 2024
2 parents 44121e0 + 5559019 commit fa73422
Show file tree
Hide file tree
Showing 83 changed files with 1,697 additions and 1,248 deletions.
12 changes: 6 additions & 6 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>0.8.9</AssemblyVersion>
<Version>2024.03.15.1259</Version>
<Version>2024.03.20.2221</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<RootNamespace>BLAZAM</RootNamespace>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
Expand Down Expand Up @@ -57,17 +57,17 @@
<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.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" 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.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.17" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.16">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
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
17 changes: 12 additions & 5 deletions BLAZAM/Pages/Configure/Templates.razor
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<MudIconButton Color=Color.Tertiary
Class="align-middle"
OnClick="@(()=>{SelectedTemplate = new();Nav.NavigateTo("/templates");})"
OnClick="@(NewTemplate)"
Icon="@Icons.Material.Filled.AddCard" />

</MudTooltip>
Expand All @@ -50,7 +50,7 @@
<MudTooltip Text="@AppLocalization["New template"]">
<MudIconButton Color=Color.Tertiary
Class="align-middle"
OnClick="@(()=>{SelectedTemplate = new();Nav.NavigateTo("/templates");})"
OnClick="@(NewTemplate)"
Icon="@Icons.Material.Filled.AddCard" />

</MudTooltip>
Expand Down Expand Up @@ -119,7 +119,7 @@
</SetHeader>
@if (Templates.Count() > 0)
{

<MudCard Elevation="2">
<MudExpansionPanel Text="@AppLocalization["Inheritance Tree"]">
<TemplateInheritanceTreeView RootTemplate="CreateTemplateHash"
Expand Down Expand Up @@ -149,13 +149,13 @@
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();

if (Templates?.Count() < 1)
{

await Task.Delay(1000);
createFirstTemplateTooltipVisible = true;




Expand Down Expand Up @@ -188,6 +188,13 @@
await RefreshComponents();

}
private async void NewTemplate()
{
SelectedTemplate = new();
TemplateIdParameter = null;
SelectedTemplate = new();
Nav.NavigateTo("/templates/0",true);
}
private HashSet<DirectoryTemplate> CreateTemplateHash
{
get
Expand Down
2 changes: 1 addition & 1 deletion BLAZAM/Pages/Groups/ConfirmNewGroup.razor
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
var result = await Group.CommitChangesAsync(createGroupJob);

disableCreateGroupButton = false;
InvokeAsync(StateHasChanged);
await InvokeAsync(StateHasChanged);
if (result.FailedSteps.Count == 0)
{

Expand Down
7 changes: 1 addition & 6 deletions BLAZAM/Pages/Groups/ViewGroup.razor
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@
</AppModal>


<AppModal Title=@AppLocalization["Change History"] @ref=@ChangeHistoryModal Options=@(new DialogOptions(){FullWidth=true,MaxWidth=MaxWidth.ExtraExtraLarge})>
@if (ChangeHistoryModal?.IsShown == true)
{
<ChangeHistoryModalContent Model="Group" />
}
</AppModal>



<MudGrid>
Expand Down
48 changes: 30 additions & 18 deletions BLAZAM/Pages/Recycle Bin/RecycleBin.razor
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
@bind-SelectedItems=@selectedEntries
Square=true
MultiSelection=true
Height="80vh"
Items="@deletedObjects"
Filterable="false"
SortMode="@SortMode.Multiple"
Groupable="false">
<ToolBarContent>
<MudText Typo="Typo.h6">Recycle Bin</MudText>
<MudSpacer />
<MudButton Color="Color.Primary" Variant="@Variant.Outlined" OnClick="@(async()=>{await RestoreSelected();})">Restore Selected</MudButton>
<MudButton Color="Color.Primary" Variant="@Variant.Outlined" OnClick="@(()=>{RestoreSelected();})">Restore Selected</MudButton>

</ToolBarContent>
<Columns>
Expand Down Expand Up @@ -73,11 +74,34 @@

await InvokeAsync(StateHasChanged);
}

//TODO stop the confimation message on batch restore
private async void RestoreSelected()
{
if (await MessageService.Confirm("Are you sure you want to restore the selected entries", "Restore?"))
{
IJob batchRestore = new Job(AppLocalization["Restore"]);
foreach (var entry in selectedEntries)
{
IJobStep restoreEntryStep = new JobStep(AppLocalization["Restore: "] + entry.CanonicalName, (step) =>
{
if (RestoreEntry(entry))
return true;
return false;

});
batchRestore.Steps.Add(restoreEntryStep);
}
batchRestore.Run();
batchRestore.ShowJobDetailsDialog(MessageService);
}
}
async Task Restore(IDirectoryEntryAdapter entryToRestore)
{
if (await MessageService.Confirm("Are you sure you want to restore " + entryToRestore.CanonicalName + " to " + entryToRestore.LastKnownParent.CanonicalName, "Restore?"))
if (entryToRestore.LastKnownParent == null) throw new ApplicationException("Tombstone item has no LastKnownParent");
if (await MessageService.Confirm("Are you sure you want to restore " + entryToRestore.CanonicalName + " to " + entryToRestore.LastKnownParent?.CanonicalName, "Restore?"))
{
if (Directory.RestoreTombstone(entryToRestore, entryToRestore.LastKnownParent))
if (RestoreEntry(entryToRestore))
{
SnackBarService.Success(entryToRestore.CanonicalName + " restored successfully");
await GetDeletedEntries();
Expand All @@ -90,21 +114,9 @@

}
}
//TODO stop the confimation message on batch restore
async Task RestoreSelected()
bool RestoreEntry(IDirectoryEntryAdapter entry)
{
IJob batchRestore = new Job(AppLocalization["Restore"]);
foreach (var entry in selectedEntries)
{
IJobStep restoreEntryStep = new JobStep(AppLocalization["Restore: "] + entry.CanonicalName, async (step) =>
{
await Restore(entry);
return true;

});
batchRestore.Steps.Add(restoreEntryStep);
}
batchRestore.Run();
batchRestore.ShowJobDetailsDialog(MessageService);
return (entry.LastKnownParent != null && Directory.RestoreTombstone(entry, entry.LastKnownParent));
}

}
4 changes: 2 additions & 2 deletions BLAZAM/Pages/SSO.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ public async Task<IActionResult> OnPost([FromFormAttribute]LoginRequest req)
// return new ObjectResult(result.Status);

}
catch (Exception ex)
catch
{

//return new ObjectResult(ex.Message);
}
if (req.ReturnUrl.IsUrlLocalToHost())
if (req.ReturnUrl!=null && req.ReturnUrl.IsUrlLocalToHost())
{
return Redirect(req.ReturnUrl);
}
Expand Down
2 changes: 1 addition & 1 deletion BLAZAM/Pages/Search.razor
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
});
Searcher.ResultsCollected += ((batch) =>
{
results.AddRange(batch);
results.AddRange(batch.Where(r=>r.CanRead));
});
}
/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions BLAZAM/Pages/Users/ConfirmNewUser.razor
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ InDirectoryTemplate(ActiveDirectoryFields.PhysicalDeliveryOffice)
bool InDirectoryTemplate(ActiveDirectoryField field)
{
if (DirectoryTemplate == null) return true;
return DirectoryTemplate?.FieldValues.Any(f => f.Field.FieldName == field.FieldName) == true;
return DirectoryTemplate?.FieldValues.Any(f => f.Field?.FieldName == field.FieldName) == true;
}
bool confirmed = false;
bool disableCreateUserButton=false;
Expand All @@ -200,7 +200,7 @@ InDirectoryTemplate(ActiveDirectoryFields.PhysicalDeliveryOffice)
var result = await User.CommitChangesAsync(createUserJob);

disableCreateUserButton = false;
InvokeAsync(StateHasChanged);
await InvokeAsync(StateHasChanged);
if (result.FailedSteps.Count == 0)
{
var newUser = Directory.Users.FindUsersByContainerName(User.CanonicalName, false, true);
Expand All @@ -210,7 +210,7 @@ InDirectoryTemplate(ActiveDirectoryFields.PhysicalDeliveryOffice)
}
SnackBarService.Success("User has been created");
confirmed = true;
Confirmed.InvokeAsync();
await Confirmed.InvokeAsync();
//Nav.NavigateTo("/search/" + User.SamAccountName);
}
Expand Down
Loading

0 comments on commit fa73422

Please sign in to comment.