From 14eb3995f0d50490310344dbedf7413255469b26 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 10:49:11 +0000 Subject: [PATCH 01/16] Bump DuoUniversal from 1.2.3 to 1.2.4 Bumps [DuoUniversal](https://github.com/duosecurity/duo_universal_csharp) from 1.2.3 to 1.2.4. - [Release notes](https://github.com/duosecurity/duo_universal_csharp/releases) - [Commits](https://github.com/duosecurity/duo_universal_csharp/compare/1.2.3...1.2.4) --- updated-dependencies: - dependency-name: DuoUniversal dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- BLAZAM/BLAZAM.csproj | 2 +- BLAZAMServices/BLAZAMServices.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BLAZAM/BLAZAM.csproj b/BLAZAM/BLAZAM.csproj index 034430a0..87dcf157 100644 --- a/BLAZAM/BLAZAM.csproj +++ b/BLAZAM/BLAZAM.csproj @@ -56,7 +56,7 @@ - + diff --git a/BLAZAMServices/BLAZAMServices.csproj b/BLAZAMServices/BLAZAMServices.csproj index 407cb362..1580f1f0 100644 --- a/BLAZAMServices/BLAZAMServices.csproj +++ b/BLAZAMServices/BLAZAMServices.csproj @@ -8,7 +8,7 @@ - + From e1f844aeff2c5220c8db3bec5a0b918f3751aff3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 10:49:26 +0000 Subject: [PATCH 02/16] Bump Serilog.Sinks.Seq from 7.0.0 to 7.0.1 Bumps [Serilog.Sinks.Seq](https://github.com/datalust/serilog-sinks-seq) from 7.0.0 to 7.0.1. - [Release notes](https://github.com/datalust/serilog-sinks-seq/releases) - [Commits](https://github.com/datalust/serilog-sinks-seq/compare/v7.0.0...v7.0.1) --- updated-dependencies: - dependency-name: Serilog.Sinks.Seq dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- BLAZAMLoggers/BLAZAMLogger.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BLAZAMLoggers/BLAZAMLogger.csproj b/BLAZAMLoggers/BLAZAMLogger.csproj index bc420fc8..b7fa8f9c 100644 --- a/BLAZAMLoggers/BLAZAMLogger.csproj +++ b/BLAZAMLoggers/BLAZAMLogger.csproj @@ -11,7 +11,7 @@ - + From a084de969065b5100223aeb84437a7f15cbdcbef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 10:25:29 +0000 Subject: [PATCH 03/16] Bump Microsoft.Playwright.NUnit from 1.43.0 to 1.44.0 Bumps [Microsoft.Playwright.NUnit](https://github.com/microsoft/playwright-dotnet) from 1.43.0 to 1.44.0. - [Release notes](https://github.com/microsoft/playwright-dotnet/releases) - [Commits](https://github.com/microsoft/playwright-dotnet/compare/v1.43.0...v1.44.0) --- updated-dependencies: - dependency-name: Microsoft.Playwright.NUnit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- PlaywrightTests/PlaywrightTests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PlaywrightTests/PlaywrightTests.csproj b/PlaywrightTests/PlaywrightTests.csproj index c8f03435..603fcd85 100644 --- a/PlaywrightTests/PlaywrightTests.csproj +++ b/PlaywrightTests/PlaywrightTests.csproj @@ -17,7 +17,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive From ab78719e697f8c9009ca3bc8a3f483e5cc5da05e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 10:27:35 +0000 Subject: [PATCH 04/16] Bump Microsoft.AspNetCore.Components.Web and Microsoft.AspNetCore.Components Bumps [Microsoft.AspNetCore.Components.Web](https://github.com/dotnet/aspnetcore) and [Microsoft.AspNetCore.Components](https://github.com/dotnet/aspnetcore). These dependencies needed to be updated together. Updates `Microsoft.AspNetCore.Components.Web` from 6.0.29 to 6.0.30 - [Release notes](https://github.com/dotnet/aspnetcore/releases) - [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md) - [Commits](https://github.com/dotnet/aspnetcore/compare/v6.0.29...v6.0.30) Updates `Microsoft.AspNetCore.Components` from 6.0.13 to 6.0.30 - [Release notes](https://github.com/dotnet/aspnetcore/releases) - [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md) - [Commits](https://github.com/dotnet/aspnetcore/compare/v6.0.13...v6.0.30) --- updated-dependencies: - dependency-name: Microsoft.AspNetCore.Components.Web dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.AspNetCore.Components dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- BLAZAMEmailMessage/BLAZAMEmailMessage.csproj | 2 +- BLAZAMGui/BLAZAMGui.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BLAZAMEmailMessage/BLAZAMEmailMessage.csproj b/BLAZAMEmailMessage/BLAZAMEmailMessage.csproj index 742cc519..2b08e687 100644 --- a/BLAZAMEmailMessage/BLAZAMEmailMessage.csproj +++ b/BLAZAMEmailMessage/BLAZAMEmailMessage.csproj @@ -13,7 +13,7 @@ - + diff --git a/BLAZAMGui/BLAZAMGui.csproj b/BLAZAMGui/BLAZAMGui.csproj index dbfa75d2..dd1c36f8 100644 --- a/BLAZAMGui/BLAZAMGui.csproj +++ b/BLAZAMGui/BLAZAMGui.csproj @@ -24,7 +24,7 @@ - + From f71b451e11ad16b35ec6abfb4da8d18e6221b68b Mon Sep 17 00:00:00 2001 From: Chris Jacobsen Date: Tue, 21 May 2024 20:19:20 -0400 Subject: [PATCH 05/16] Remove old user settings initialization in API Token generator --- BLAZAM/Pages/API/Token.cshtml.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/BLAZAM/Pages/API/Token.cshtml.cs b/BLAZAM/Pages/API/Token.cshtml.cs index 222acdff..9973e9e1 100644 --- a/BLAZAM/Pages/API/Token.cshtml.cs +++ b/BLAZAM/Pages/API/Token.cshtml.cs @@ -42,16 +42,7 @@ public JsonResult OnGet() { userSettings.APIToken = Token; } - else - { - userSettings = new AppUser - { - UserGUID = User.Identity.Name, - APIToken = Token - }; - Context.UserSettings.Add(userSettings); - - } + Context.SaveChanges(); return new JsonResult(userSettings); } From 20a188050294ab57e23bcf0bd426918fb7d6a3b4 Mon Sep 17 00:00:00 2001 From: Chris Jacobsen Date: Tue, 21 May 2024 20:20:58 -0400 Subject: [PATCH 06/16] Remove uneccessary null checks --- BLAZAM/Pages/Configure/Fields.razor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BLAZAM/Pages/Configure/Fields.razor b/BLAZAM/Pages/Configure/Fields.razor index c2489bd7..8e197b3b 100644 --- a/BLAZAM/Pages/Configure/Fields.razor +++ b/BLAZAM/Pages/Configure/Fields.razor @@ -61,13 +61,13 @@ + Value="@(context.Item.ObjectTypes.Where(ot=>ot.ObjectType==objectType).Any()==true)" /> } - 100000) + 100000) Size="@Size.Small" Icon="@Icons.Material.Outlined.Delete" OnClick="@(async()=>{await Delete(context.Item);})" /> @@ -109,9 +109,9 @@ if (await MessageService.Confirm("Are you sure you want to delete " + field.DisplayName + "?", "Delete " + field.DisplayName + "?")) { field.DeletedAt = DateTime.UtcNow; - if (Context != null && await Context.SaveChangesAsync() > 0) + if (Context != null && await Context.SaveChangesAsync() > 0 && fieldGrid!=null) { - await fieldGrid?.ReloadServerData(); + await fieldGrid.ReloadServerData(); SnackBarService.Success(field.DisplayName + " deleted"); } From 0af7616497fa9737b911219377cec1fb70a98d29 Mon Sep 17 00:00:00 2001 From: Chris Jacobsen Date: Tue, 21 May 2024 20:21:41 -0400 Subject: [PATCH 07/16] Remove exception collection --- BLAZAM/Pages/MFACallback.cshtml.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BLAZAM/Pages/MFACallback.cshtml.cs b/BLAZAM/Pages/MFACallback.cshtml.cs index 76ebe933..25e5a2d0 100644 --- a/BLAZAM/Pages/MFACallback.cshtml.cs +++ b/BLAZAM/Pages/MFACallback.cshtml.cs @@ -77,8 +77,9 @@ public async Task OnGet(string? state=null,string? code=null) await _audit.Logon.Login(user.User, HttpContext.Connection.RemoteIpAddress?.ToString()); return new RedirectResult("/"); } - }catch (Exception ex) + }catch { + return new RedirectResult("/"); } From 5e21c0ede4437ebea9e559b600c25f0813ea85f3 Mon Sep 17 00:00:00 2001 From: Chris Jacobsen Date: Tue, 21 May 2024 20:21:56 -0400 Subject: [PATCH 08/16] Improved comments --- BLAZAM/ProgramHelpers.cs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/BLAZAM/ProgramHelpers.cs b/BLAZAM/ProgramHelpers.cs index 93bab51e..107065b2 100644 --- a/BLAZAM/ProgramHelpers.cs +++ b/BLAZAM/ProgramHelpers.cs @@ -35,6 +35,11 @@ namespace BLAZAM.Server { public static class ProgramHelpers { + /// + /// Sets up the core configuration like debug, installation id, and running process and version + /// + /// + /// public static WebApplicationBuilder IntializeProperties(this WebApplicationBuilder builder) { //Set DebugMode flag from configuration @@ -45,25 +50,27 @@ public static WebApplicationBuilder IntializeProperties(this WebApplicationBuild //Set the installation ID try { + //Attempts to get the windows installation GUID ApplicationInfo.installationId = GetInstallationId(); - }catch (Exception ex) + }catch { + //Default to a hash type method on the machine name ApplicationInfo.installationId = Environment.MachineName.ToGuid(); } - //Set application directories - //Program.RootDirectory = new SystemDirectory(builder.Environment.ContentRootPath); - //Program.TempDirectory = new SystemDirectory(Path.GetTempPath() + "Blazam\\"); + Program.AppDataDirectory = new SystemDirectory(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Blazam\\"); //Store the configuration so other pages/objects can easily access it Program.Configuration = builder.Configuration; - + //Captures the running process ApplicationInfo.runningProcess = Process.GetCurrentProcess(); + + //Gets the application version from he running assembly version ApplicationInfo.runningVersion = new ApplicationVersion(Assembly.GetExecutingAssembly()) ; @@ -208,6 +215,7 @@ completed so it may not be usable as is //Provide an Http client as a service with custom construction via api service class builder.Services.AddHttpClient(); + //Also keeping this here for a possible future API, though this would be for internal use //builder.Services.AddTransient(); //builder.Services.AddTransient(provider => provider.GetService().HttpContext.User); @@ -225,7 +233,7 @@ completed so it may not be usable as is //Provide chat as a service builder.Services.AddSingleton(); - + //Sets up Active Directory communications builder.Services.AddActiveDirectoryServices(); @@ -252,7 +260,8 @@ completed so it may not be usable as is builder.Services.AddScoped(); - + //A substitue Navigation Manager for the app to enable navigation warning on unsaved + //changes builder.Services.AddScoped(); From a35695d97706fbc0cb2329784482b19e7993102b Mon Sep 17 00:00:00 2001 From: Chris Jacobsen Date: Tue, 21 May 2024 20:22:34 -0400 Subject: [PATCH 09/16] Completed migration to new ADSearch --- .../Searchers/ADGroupSearcher.cs | 6 ++--- .../Searchers/ADOUSearcher.cs | 6 ++--- .../Searchers/ADPrinterSearcher.cs | 2 +- BLAZAMActiveDirectory/Searchers/ADSearch.cs | 14 +++++++++-- BLAZAMActiveDirectory/Searchers/ADSearcher.cs | 25 +++++++++---------- .../Searchers/ADUserSearcher.cs | 4 +-- 6 files changed, 33 insertions(+), 24 deletions(-) diff --git a/BLAZAMActiveDirectory/Searchers/ADGroupSearcher.cs b/BLAZAMActiveDirectory/Searchers/ADGroupSearcher.cs index 6c72142a..53efd152 100644 --- a/BLAZAMActiveDirectory/Searchers/ADGroupSearcher.cs +++ b/BLAZAMActiveDirectory/Searchers/ADGroupSearcher.cs @@ -95,7 +95,7 @@ public async Task> FindNewGroupsAsync(int maxAgeInDays = 14) public List? GetAllNestedMembers(IADGroup group) { string UserSearchFieldsQuery = "(&(memberOf:1.2.840.113556.1.4.1941:=" + group.DN + "))"; - return ConvertTo(SearchObjects(UserSearchFieldsQuery, ActiveDirectoryObjectType.User)).Cast().ToList(); + return SearchObjects(UserSearchFieldsQuery, ActiveDirectoryObjectType.User).Cast().ToList(); } @@ -173,7 +173,7 @@ public List GetDirectUserMembers(IADGroup group, bool ignoreDisabledUse }.Search(); */ string UserSearchFieldsQuery = "(memberOf=" + group.DN + ")"; - return new List(ConvertTo(SearchObjects(UserSearchFieldsQuery, ActiveDirectoryObjectType.User, 500, ignoreDisabledUsers))); + return SearchObjects(UserSearchFieldsQuery, ActiveDirectoryObjectType.User, 500, ignoreDisabledUsers).Cast().ToList(); } @@ -188,7 +188,7 @@ public List GetGroupMembers(IADGroup group) }.Search(); */ string UserSearchFieldsQuery = "(memberOf=" + group.DN + ")"; - return new List(ConvertTo(SearchObjects(UserSearchFieldsQuery, ActiveDirectoryObjectType.Group, 500))); + return SearchObjects(UserSearchFieldsQuery, ActiveDirectoryObjectType.Group, 500).Cast().ToList(); } diff --git a/BLAZAMActiveDirectory/Searchers/ADOUSearcher.cs b/BLAZAMActiveDirectory/Searchers/ADOUSearcher.cs index aaabc6a6..f845eaec 100644 --- a/BLAZAMActiveDirectory/Searchers/ADOUSearcher.cs +++ b/BLAZAMActiveDirectory/Searchers/ADOUSearcher.cs @@ -49,9 +49,9 @@ public List FindOuByString(string searchTerm) return FindOuByString(searchTerm).OrderBy(x => x.DN).FirstOrDefault(); } - public List FindSubOusByDN(string? searchBaseDN) => new List(ConvertTo(SearchObjects(searchBaseDN, "", ActiveDirectoryObjectType.OU, 1000, true, SearchScope.OneLevel))); + public List FindSubOusByDN(string? searchBaseDN) => SearchObjects(searchBaseDN, "", ActiveDirectoryObjectType.OU, 1000, true, SearchScope.OneLevel).Cast().ToList(); - public List FindSubUsersByDN(string searchBaseDN) => new List(ConvertTo(SearchObjects(searchBaseDN, "", ActiveDirectoryObjectType.User, 1000, true, SearchScope.OneLevel))); + public List FindSubUsersByDN(string searchBaseDN) => SearchObjects(searchBaseDN, "", ActiveDirectoryObjectType.User, 1000, true, SearchScope.OneLevel).Cast().ToList(); public List FindSubComputerByDN(string searchBaseDN) { var search = NewSearch; @@ -61,7 +61,7 @@ public List FindSubComputerByDN(string searchBaseDN) { } // new List(ConvertTo(SearchObjects(searchBaseDN, "", ActiveDirectoryObjectType.Computer, 1000, true, SearchScope.OneLevel))); - public List FindSubGroupsByDN(string searchBaseDN) => new List(ConvertTo(SearchObjects(searchBaseDN, "", ActiveDirectoryObjectType.Group, 1000, true, SearchScope.OneLevel))); + public List FindSubGroupsByDN(string searchBaseDN) => SearchObjects(searchBaseDN, "", ActiveDirectoryObjectType.Group, 1000, true, SearchScope.OneLevel).Cast().ToList(); diff --git a/BLAZAMActiveDirectory/Searchers/ADPrinterSearcher.cs b/BLAZAMActiveDirectory/Searchers/ADPrinterSearcher.cs index 79b83df1..be2fb59f 100644 --- a/BLAZAMActiveDirectory/Searchers/ADPrinterSearcher.cs +++ b/BLAZAMActiveDirectory/Searchers/ADPrinterSearcher.cs @@ -91,7 +91,7 @@ public List FindChangedPrinters(bool? ignoreDisabledPrinters = true, var tstamp = threeMonthsAgo.ToString("yyyyMMddHHmmss.fZ"); string PrintersearchFieldsQuery = "(whenChanged>=" + tstamp + ")"; - return new List(ConvertTo(SearchObjects(PrintersearchFieldsQuery, ActiveDirectoryObjectType.User, 1000, ignoreDisabledPrinters)).OrderByDescending(u => u.LastChanged)); + return SearchObjects(PrintersearchFieldsQuery, ActiveDirectoryObjectType.User, 1000, ignoreDisabledPrinters).Cast().OrderByDescending(u => u.LastChanged).ToList(); } diff --git a/BLAZAMActiveDirectory/Searchers/ADSearch.cs b/BLAZAMActiveDirectory/Searchers/ADSearch.cs index 0bf30c17..469136d1 100644 --- a/BLAZAMActiveDirectory/Searchers/ADSearch.cs +++ b/BLAZAMActiveDirectory/Searchers/ADSearch.cs @@ -22,8 +22,16 @@ namespace BLAZAM.ActiveDirectory.Searchers { + /// + /// Represents the state of the search process. + /// public enum SearchState { Ready, Started, Collecting, Completed }; + /// + /// The ADSearch class provides a powerful and flexible mechanism for performing searches within an Active Directory environment. + /// By configuring various search parameters, users can query the directory for specific types of objects, such as users, groups, + /// computers, organizational units, and more. This class leverages LDAP queries to retrieve and filter results efficiently. + /// public class ADSearch : SearchBase { @@ -107,7 +115,7 @@ public async Task> SearchAsync() else cancellationToken = new CancellationToken(); if (cancellationToken?.IsCancellationRequested == true) return new(); - DateTime startTime = NewMethod(); + DateTime startTime = InitializeSearch(); DirectorySearcher searcher; try { @@ -120,6 +128,8 @@ public async Task> SearchAsync() //Make sure this is not usable //Seems to never pull ou's //VirtualListView = new DirectoryVirtualListView(0, pageSize - 1, pageOffset), + SearchScope=SearchScope, + SizeLimit= MaxResults, Filter = "(&(|(&(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))(objectClass=group)(&(objectCategory=computer)(!userAccountControl:1.2.840.113556.1.4.803:=2))(objectClass=organizationalUnit)(objectClass=printQueue)))" }; if (EnabledOnly != true) @@ -253,7 +263,7 @@ public async Task> SearchAsync() } - private DateTime NewMethod() + private DateTime InitializeSearch() { var startTime = DateTime.Now; SearchState = SearchState.Started; diff --git a/BLAZAMActiveDirectory/Searchers/ADSearcher.cs b/BLAZAMActiveDirectory/Searchers/ADSearcher.cs index 23f514b4..6535342f 100644 --- a/BLAZAMActiveDirectory/Searchers/ADSearcher.cs +++ b/BLAZAMActiveDirectory/Searchers/ADSearcher.cs @@ -17,7 +17,7 @@ public ADSearcher(IActiveDirectoryContext directory) { Directory = directory; } - protected virtual SearchResultCollection SearchObjects( + protected virtual List? SearchObjects( string fieldQuery, ActiveDirectoryObjectType searchType, int returnCount = 5, @@ -30,7 +30,7 @@ protected virtual SearchResultCollection SearchObjects( - protected virtual SearchResultCollection SearchObjects( + protected virtual List? SearchObjects( string? searchBaseDN, string fieldQuery, ActiveDirectoryObjectType? searchType, @@ -44,15 +44,12 @@ protected virtual SearchResultCollection SearchObjects( - //if (enabledOnly == false) Don't do this to allow disabled only searches - //if trying to find disabled users, set to null to include both enabled and disabled - //enabledOnly = null; DirectorySearcher searcher; try { - /* + ADSearch search = new ADSearch(); @@ -62,13 +59,14 @@ protected virtual SearchResultCollection SearchObjects( search.MaxResults = returnCount; search.SearchScope = searchScope; search.EnabledOnly = enabledOnly; - return search.Search(); - + var results = search.Search(); + return results; - */ - + + /* + * Obsoleete code from previous searcher method searcher = new DirectorySearcher(Directory.GetDirectoryEntry(searchBaseDN)); searcher.Filter = "(&(objectClass=*))"; switch (searchType) @@ -118,11 +116,12 @@ protected virtual SearchResultCollection SearchObjects( searcher.Filter = searcher.Filter.Substring(0, searcher.Filter.Length - 1) + fieldQuery + ")"; var result = searcher.FindAll(); - return result; + //return result; + */ } catch (Exception ex) { - Loggers.ActiveDirectryLogger.Error("Directory Entry failed to connect {@Error}", ex); + Loggers.ActiveDirectryLogger.Error("Search failed {@Error}", ex); } return null; // Set the filter to look for a specific user @@ -137,7 +136,7 @@ protected virtual SearchResultCollection SearchObjects( - protected SearchResultCollection SearchObjectBySID(string sid) => SearchObjects(null, "(objectSid=" + sid + ")", null, 1, false); + protected List? SearchObjectBySID(string sid) => SearchObjects(null, "(objectSid=" + sid + ")", null, 1, false); protected List ConvertTo(SearchResultCollection r) where T : IDirectoryEntryAdapter, new() { diff --git a/BLAZAMActiveDirectory/Searchers/ADUserSearcher.cs b/BLAZAMActiveDirectory/Searchers/ADUserSearcher.cs index 5aa6a910..9a2a01ea 100644 --- a/BLAZAMActiveDirectory/Searchers/ADUserSearcher.cs +++ b/BLAZAMActiveDirectory/Searchers/ADUserSearcher.cs @@ -114,7 +114,7 @@ public List FindChangedPasswordUsers(bool? ignoreDisabledUsers = true) var tstamp = threeMonthsAgo.ToString("yyyyMMddHHmmss.fZ"); string UserSearchFieldsQuery = "(pwdLastSet>=" + tstamp + ")"; - return new List(ConvertTo(SearchObjects(UserSearchFieldsQuery, ActiveDirectoryObjectType.User, 1000, ignoreDisabledUsers)).OrderByDescending(u => u.PasswordLastSet)); + return SearchObjects(UserSearchFieldsQuery, ActiveDirectoryObjectType.User, 1000, ignoreDisabledUsers).Cast().OrderByDescending(u => u.PasswordLastSet).ToList(); } @@ -133,7 +133,7 @@ public List FindChangedUsers(bool? ignoreDisabledUsers = true, int days var tstamp = threeMonthsAgo.ToString("yyyyMMddHHmmss.fZ"); string UserSearchFieldsQuery = "(whenChanged>=" + tstamp + ")"; - return new List(ConvertTo(SearchObjects(UserSearchFieldsQuery, ActiveDirectoryObjectType.User, 1000, ignoreDisabledUsers)).OrderByDescending(u => u.LastChanged)); + return SearchObjects(UserSearchFieldsQuery, ActiveDirectoryObjectType.User, 1000, ignoreDisabledUsers).Cast().OrderByDescending(u => u.LastChanged).ToList(); } public IADUser? FindUserBySID(string? sid) From 2bdf942e6987f31e8a4fd41fc895462313b78393 Mon Sep 17 00:00:00 2001 From: Chris Jacobsen Date: Tue, 21 May 2024 20:22:59 -0400 Subject: [PATCH 10/16] Deprecated AppValidationRule class --- BLAZAMCommon/Data/AppValidationRule.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/BLAZAMCommon/Data/AppValidationRule.cs b/BLAZAMCommon/Data/AppValidationRule.cs index 294064f9..f2239c55 100644 --- a/BLAZAMCommon/Data/AppValidationRule.cs +++ b/BLAZAMCommon/Data/AppValidationRule.cs @@ -4,6 +4,11 @@ namespace BLAZAM.Common.Data { + + /// + /// Appears to be for Blazorise + /// + [Obsolete("Old Validation rules for Blazorise")] public static class AppValidationRule { // @@ -19,6 +24,8 @@ public static class AppValidationRule // // Returns: // True if they are equal. + [Obsolete("Old Validation rules for Blazorise")] + public static bool IsEqual(string value, string compare) { try @@ -47,6 +54,8 @@ public static bool IsEqual(string value, string compare) // // Returns: // True if string length is in the range. + [Obsolete("Old Validation rules for Blazorise")] + public static bool IsLength(string value, int min, int max) { return value.Length>min && value.Length Date: Tue, 21 May 2024 20:23:19 -0400 Subject: [PATCH 11/16] Improved comments --- BLAZAM/BLAZAM.csproj | 2 +- BLAZAMGui/UI/Inputs/TreeViews/OUTreeViewBase.cs | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/BLAZAM/BLAZAM.csproj b/BLAZAM/BLAZAM.csproj index 45f2e438..035cdb92 100644 --- a/BLAZAM/BLAZAM.csproj +++ b/BLAZAM/BLAZAM.csproj @@ -6,7 +6,7 @@ enable false 0.9.2 - 2024.05.07.1847 + 2024.05.21.2352 false BLAZAM False diff --git a/BLAZAMGui/UI/Inputs/TreeViews/OUTreeViewBase.cs b/BLAZAMGui/UI/Inputs/TreeViews/OUTreeViewBase.cs index 30d4192d..d6abdf77 100644 --- a/BLAZAMGui/UI/Inputs/TreeViews/OUTreeViewBase.cs +++ b/BLAZAMGui/UI/Inputs/TreeViews/OUTreeViewBase.cs @@ -24,7 +24,12 @@ public class OUTreeViewBase : AppComponentBase [Parameter] public string? Label { get; set; } - + /// + /// The root ou of this TreeView + /// + /// + /// Defaults to the App Base root + /// [Parameter] public HashSet RootOU { get; set; } = new HashSet(); [Parameter] @@ -78,6 +83,9 @@ public IDirectoryEntryAdapter? SelectedEntry [Parameter] public EventCallback SelectedEntryChanged { get; set; } + /// + /// Text to show at the end of the TreeView item + /// [Parameter] public Func? EndText { get; set; } @@ -174,8 +182,14 @@ protected void OpenToSelected() } + /// + /// Defines a function to determine whether an Active Directory object should be + /// displayed in the tree view or not + /// [Parameter] public Func? AdditionalVisibilityFilters { get; set; } + + protected bool ShouldShowOU(IDirectoryEntryAdapter entry) { if (entry is IADOrganizationalUnit ou) From fd181d32b30321159b82d9030115c72aa4b6ef07 Mon Sep 17 00:00:00 2001 From: Chris Jacobsen Date: Tue, 21 May 2024 21:34:48 -0400 Subject: [PATCH 12/16] Add description to group view page #362 --- BLAZAM/BLAZAM.csproj | 2 +- BLAZAM/Pages/Groups/ViewGroup.razor | 122 ++++++++++++++-------------- 2 files changed, 63 insertions(+), 61 deletions(-) diff --git a/BLAZAM/BLAZAM.csproj b/BLAZAM/BLAZAM.csproj index 035cdb92..6cd70c7d 100644 --- a/BLAZAM/BLAZAM.csproj +++ b/BLAZAM/BLAZAM.csproj @@ -6,7 +6,7 @@ enable false 0.9.2 - 2024.05.21.2352 + 2024.05.22.0109 false BLAZAM False diff --git a/BLAZAM/Pages/Groups/ViewGroup.razor b/BLAZAM/Pages/Groups/ViewGroup.razor index 1f0d12ad..34de831f 100644 --- a/BLAZAM/Pages/Groups/ViewGroup.razor +++ b/BLAZAM/Pages/Groups/ViewGroup.razor @@ -5,34 +5,34 @@ - - - - - - - - - - - - - {AssignToModal?.Hide(); InvokeAsync(StateHasChanged);}) DirectoryModel="Group" /> - - - {AssignMemberModal?.Hide();InvokeAsync(StateHasChanged);}) Group="Group" /> - - - @if (MoveToModal?.IsShown == true) + + + + + + + + + + + + + {AssignToModal?.Hide(); InvokeAsync(StateHasChanged);}) DirectoryModel="Group" /> + + + {AssignMemberModal?.Hide();InvokeAsync(StateHasChanged);}) Group="Group" /> + + + @if (MoveToModal?.IsShown == true) { } @@ -46,7 +46,7 @@ - + @@ -54,51 +54,53 @@
- + + - - - @AppLocalization["Created"]: - - + - + + @AppLocalization["Created"]: + + - + - @AppLocalization["Last Change"]: - + - + @AppLocalization["Last Change"]: + - + + - - @AppLocalization["OU"]: - - @Group.OU.ToPrettyOu() - + + @AppLocalization["OU"]: + + @Group.OU.ToPrettyOu() + -
- - -
- -
-
- -
- +
+
+ +
+ + +
+
+ +
+ -
-
-
+ + + @@ -112,7 +114,7 @@ - @if (Group.CanEdit && Group.HasUnsavedChanges) + @if (Group.CanEdit && Group.HasUnsavedChanges) { } From 381268f36faa2b4f8952738be51298d3326571c8 Mon Sep 17 00:00:00 2001 From: Chris Jacobsen Date: Tue, 21 May 2024 21:43:46 -0400 Subject: [PATCH 13/16] Allow editing of descripion --- BLAZAM/Pages/Groups/ViewGroup.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BLAZAM/Pages/Groups/ViewGroup.razor b/BLAZAM/Pages/Groups/ViewGroup.razor index 34de831f..9061e4de 100644 --- a/BLAZAM/Pages/Groups/ViewGroup.razor +++ b/BLAZAM/Pages/Groups/ViewGroup.razor @@ -56,7 +56,7 @@ - + From f49d1317fd0e98ee38caa13364e68e526029aeec Mon Sep 17 00:00:00 2001 From: Chris Jacobsen Date: Tue, 21 May 2024 21:47:15 -0400 Subject: [PATCH 14/16] Align permissions to AD read #362 --- .../UI/Users/RenameUserModalContent.razor | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/BLAZAMGui/UI/Users/RenameUserModalContent.razor b/BLAZAMGui/UI/Users/RenameUserModalContent.razor index 36e1b208..4f840991 100644 --- a/BLAZAMGui/UI/Users/RenameUserModalContent.razor +++ b/BLAZAMGui/UI/Users/RenameUserModalContent.razor @@ -1,34 +1,30 @@ @inherits AppModalContent @if (User != null && _privateUserInstance != null) { - @if (User.CanReadField(ActiveDirectoryFields.GivenName)) - { + - } - @if (User.CanReadField(ActiveDirectoryFields.MiddleName)) - { + + - } - @if (User.CanReadField(ActiveDirectoryFields.SN)) - { + + - } - @if (User.CanReadField(ActiveDirectoryFields.DisplayName)) - { + + - } + @if (User.CanEditField(ActiveDirectoryFields.SAMAccountName)) From 2d759da7551e4f1404feb4b620f9e3bd8f8ef787 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 May 2024 21:38:37 +0000 Subject: [PATCH 15/16] Bump Microsoft.EntityFrameworkCore.Abstractions from 7.0.18 to 7.0.19 Bumps [Microsoft.EntityFrameworkCore.Abstractions](https://github.com/dotnet/efcore) from 7.0.18 to 7.0.19. - [Release notes](https://github.com/dotnet/efcore/releases) - [Commits](https://github.com/dotnet/efcore/compare/v7.0.18...v7.0.19) --- updated-dependencies: - dependency-name: Microsoft.EntityFrameworkCore.Abstractions dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- BLAZAM/BLAZAM.csproj | 2 +- BLAZAMCommon.Tests/BLAZAMCommon.Tests.csproj | 2 +- BLAZAMCommon/BLAZAMCommon.csproj | 2 +- BLAZAMDatabase/BLAZAMDatabase.csproj | 2 +- BLAZAMGui/BLAZAMGui.csproj | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/BLAZAM/BLAZAM.csproj b/BLAZAM/BLAZAM.csproj index 6cd70c7d..56fc0fab 100644 --- a/BLAZAM/BLAZAM.csproj +++ b/BLAZAM/BLAZAM.csproj @@ -64,7 +64,7 @@ - + diff --git a/BLAZAMCommon.Tests/BLAZAMCommon.Tests.csproj b/BLAZAMCommon.Tests/BLAZAMCommon.Tests.csproj index 4dbba57d..76b51e15 100644 --- a/BLAZAMCommon.Tests/BLAZAMCommon.Tests.csproj +++ b/BLAZAMCommon.Tests/BLAZAMCommon.Tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/BLAZAMCommon/BLAZAMCommon.csproj b/BLAZAMCommon/BLAZAMCommon.csproj index 537fd770..2e7cb603 100644 --- a/BLAZAMCommon/BLAZAMCommon.csproj +++ b/BLAZAMCommon/BLAZAMCommon.csproj @@ -22,7 +22,7 @@ - + diff --git a/BLAZAMDatabase/BLAZAMDatabase.csproj b/BLAZAMDatabase/BLAZAMDatabase.csproj index f2285f9a..d045a3e6 100644 --- a/BLAZAMDatabase/BLAZAMDatabase.csproj +++ b/BLAZAMDatabase/BLAZAMDatabase.csproj @@ -9,7 +9,7 @@ - + diff --git a/BLAZAMGui/BLAZAMGui.csproj b/BLAZAMGui/BLAZAMGui.csproj index dd1c36f8..94785273 100644 --- a/BLAZAMGui/BLAZAMGui.csproj +++ b/BLAZAMGui/BLAZAMGui.csproj @@ -25,7 +25,7 @@ - + From b85c00d605a1ae27421abc973d80e8f35e52af26 Mon Sep 17 00:00:00 2001 From: Chris Jacobsen Date: Wed, 22 May 2024 19:40:51 -0400 Subject: [PATCH 16/16] Fix for category lock-in #352 --- BLAZAM/BLAZAM.csproj | 2 +- BLAZAM/Pages/Users/CreateUser.razor | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/BLAZAM/BLAZAM.csproj b/BLAZAM/BLAZAM.csproj index 6cd70c7d..77d49551 100644 --- a/BLAZAM/BLAZAM.csproj +++ b/BLAZAM/BLAZAM.csproj @@ -6,7 +6,7 @@ enable false 0.9.2 - 2024.05.22.0109 + 2024.05.22.2338 false BLAZAM False diff --git a/BLAZAM/Pages/Users/CreateUser.razor b/BLAZAM/Pages/Users/CreateUser.razor index 3baaa676..2844a3f2 100644 --- a/BLAZAM/Pages/Users/CreateUser.razor +++ b/BLAZAM/Pages/Users/CreateUser.razor @@ -41,15 +41,18 @@ - + - - @foreach (var template in TemplatesUserCanUse.Where(t => t.DeletedAt == null && t.Visible)) { - {await SetTemplate(template);}) Variant="Variant.Filled" Color="Color.Primary" Size="Size.Large">@template.Name + {await SetTemplate(template);}) + Variant="Variant.Filled" + Color="Color.Primary" + Size="Size.Large">@template.Name }