diff --git a/BLAZAM/BLAZAM - Backup.csproj b/BLAZAM/BLAZAM - Backup.csproj
new file mode 100644
index 000000000..d3f8fdfae
--- /dev/null
+++ b/BLAZAM/BLAZAM - Backup.csproj
@@ -0,0 +1,142 @@
+
+
+
+ net8.0
+ enable
+ enable
+ false
+ 1.0.7
+ 2024.11.02.0114
+ false
+ BLAZAM
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+ Never
+
+
+ PreserveNewest
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+
+
+
+
+
diff --git a/BLAZAM/BLAZAM.csproj b/BLAZAM/BLAZAM.csproj
index 65a731a0b..b335af3c2 100644
--- a/BLAZAM/BLAZAM.csproj
+++ b/BLAZAM/BLAZAM.csproj
@@ -5,8 +5,8 @@
enable
enable
false
- 1.0.7
- 2024.10.31.0016
+ 1.1.0
+ 2024.11.13.2234
false
BLAZAM
False
@@ -58,6 +58,10 @@
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/BLAZAM/Pages/Computers/ViewBitLocker.razor b/BLAZAM/Pages/Computers/ViewBitLocker.razor
index b70869a38..6d4f2cb42 100644
--- a/BLAZAM/Pages/Computers/ViewBitLocker.razor
+++ b/BLAZAM/Pages/Computers/ViewBitLocker.razor
@@ -4,9 +4,7 @@
-
-
-
+
diff --git a/BLAZAM/Pages/Computers/ViewComputer.razor b/BLAZAM/Pages/Computers/ViewComputer.razor
index c5cdc78e9..a6c329f3a 100644
--- a/BLAZAM/Pages/Computers/ViewComputer.razor
+++ b/BLAZAM/Pages/Computers/ViewComputer.razor
@@ -24,9 +24,7 @@
OnUnlock="@Unlock"
OnShowHistory="@(()=>{ChangeHistoryModal?.ShowAsync();})"
OnShowPermissions="@(()=>{EffectivePermissionsModal?.ShowAsync();})" />
-
-
-
+
@@ -231,9 +229,7 @@
}
}
-
-
-
+
@@ -292,7 +288,7 @@
Computer.Delete();
SnackBarService.Success(Computer.CanonicalName + " has been deleted.");
await AuditLogger.Computer.Deleted(Computer);
- _ = OUNotificationService.PostAsync(Computer, NotificationType.Delete);
+ _ = NotificationGenerationService.PostAsync(Computer, NotificationType.Delete, CurrentUser.State);
Nav.NavigateTo("/users/search");
@@ -332,7 +328,7 @@
}
if (changes.Any(c => c.Field != ActiveDirectoryFields.MemberOf.FieldName))
{
- _ = OUNotificationService.PostAsync(Computer, NotificationType.Modify);
+ _ = NotificationGenerationService.PostAsync(Computer, NotificationType.Modify, CurrentUser.State);
await AuditLogger.User.Changed(Computer, changes.Where(c => c.Field != ActiveDirectoryFields.MemberOf.FieldName).ToList());
}
diff --git a/BLAZAM/Pages/Configure/Audit.razor b/BLAZAM/Pages/Configure/Audit.razor
index e4a5c8fd9..e62dcb98a 100644
--- a/BLAZAM/Pages/Configure/Audit.razor
+++ b/BLAZAM/Pages/Configure/Audit.razor
@@ -11,8 +11,8 @@
-Audit
-
Audit
+@AppLocalization["Audit"]
+@AppLocalization["Audit"]
diff --git a/BLAZAM/Pages/Configure/Fields.razor b/BLAZAM/Pages/Configure/Fields.razor
index 1d1e5ca48..ee92a9053 100644
--- a/BLAZAM/Pages/Configure/Fields.razor
+++ b/BLAZAM/Pages/Configure/Fields.razor
@@ -3,6 +3,9 @@
@inherits DatabaseComponentBase
@attribute [Authorize(Roles = UserRoles.SuperAdmin)]
+@AppLocalization["Fields"]
+
+@AppLocalization["Fields"]
- @AppLocalization["Fields"]
-
-
+
diff --git a/BLAZAM/Pages/Configure/Permissions.razor b/BLAZAM/Pages/Configure/Permissions.razor
index 5a08d27be..bfb88e993 100644
--- a/BLAZAM/Pages/Configure/Permissions.razor
+++ b/BLAZAM/Pages/Configure/Permissions.razor
@@ -3,8 +3,8 @@
@attribute [Authorize(Roles = UserRoles.SuperAdmin)]
@inherits TabbedAppComponentBase
+@AppLocalization["Permissions"]
-Permissions
@@ -48,7 +48,7 @@
@if (Monitor.DirectoryConnectionStatus == ServiceConnectionState.Up)
{
-
+
}
@@ -76,6 +76,22 @@
+
+
+
+ @if (Monitor.DirectoryConnectionStatus == ServiceConnectionState.Up)
+ {
+
+
+ }
+
+
+
+
+ @AppLocalization["Global Settings"]
+
+
+
diff --git a/BLAZAM/Pages/Configure/Settings.razor b/BLAZAM/Pages/Configure/Settings.razor
index fb19aa314..8d31f69ed 100644
--- a/BLAZAM/Pages/Configure/Settings.razor
+++ b/BLAZAM/Pages/Configure/Settings.razor
@@ -4,8 +4,8 @@
@attribute [Authorize(Roles = UserRoles.SuperAdmin)]
@inherits TabbedAppComponentBase
+@AppLocalization["Settings"]
-Settings
diff --git a/BLAZAM/Pages/Configure/Templates.razor b/BLAZAM/Pages/Configure/Templates.razor
index 9113ca5f2..86d0946aa 100644
--- a/BLAZAM/Pages/Configure/Templates.razor
+++ b/BLAZAM/Pages/Configure/Templates.razor
@@ -127,6 +127,8 @@
+
+@AppLocalization["Templates"]
@if (Templates.Count() > 0)
{
diff --git a/BLAZAM/Pages/Error/UnhandledExceptionPage.razor b/BLAZAM/Pages/Error/UnhandledExceptionPage.razor
index 02206eff5..3a5c3ecef 100644
--- a/BLAZAM/Pages/Error/UnhandledExceptionPage.razor
+++ b/BLAZAM/Pages/Error/UnhandledExceptionPage.razor
@@ -40,7 +40,10 @@
}
+ else
+ {
To see error details, set DebugMode to true in appsettings.json in the Blazam installation directory.
+ }
}
catch (Exception ex)
diff --git a/BLAZAM/Pages/Groups/ConfirmNewGroup.razor b/BLAZAM/Pages/Groups/ConfirmNewGroup.razor
index 018398851..cb1db960f 100644
--- a/BLAZAM/Pages/Groups/ConfirmNewGroup.razor
+++ b/BLAZAM/Pages/Groups/ConfirmNewGroup.razor
@@ -1,5 +1,5 @@
@inherits AppComponentBase
-@inject OUNotificationService OUNotificationService
+@inject NotificationGenerationService OUNotificationService
Confirm Group Creation
@@ -43,7 +43,7 @@
}
await AuditLogger.Group.Created(Group);
- _ = OUNotificationService.PostAsync(Group, NotificationType.Create);
+ _ = OUNotificationService.PostAsync(Group, NotificationType.Create,CurrentUser.State);
var commitJob = Group.CommitChanges();
await Confirmed.InvokeAsync(Group);
diff --git a/BLAZAM/Pages/Groups/ViewGroup.razor b/BLAZAM/Pages/Groups/ViewGroup.razor
index 820badf1b..fddddd9e3 100644
--- a/BLAZAM/Pages/Groups/ViewGroup.razor
+++ b/BLAZAM/Pages/Groups/ViewGroup.razor
@@ -20,7 +20,7 @@
OnShowHistory="@(()=>{ChangeHistoryModal?.ShowAsync();})"
OnShowPermissions="@(()=>{EffectivePermissionsModal?.ShowAsync();})"
OnToggleEditMode="@ToggleEditMode" />
-
+
@@ -161,7 +161,7 @@
{
await AuditLogger.User.Assigned(assignment.Member, assignment.Group);
await AuditLogger.Group.MemberAdded(assignment.Group, assignment.Member);
- _ = OUNotificationService.PostAsync(assignment.Member, NotificationType.GroupAssignment, target: Group);
+ _ = NotificationGenerationService.PostAsync(assignment.Member, NotificationType.GroupAssignment, CurrentUser.State, Group);
}
@@ -169,12 +169,12 @@
{
await AuditLogger.User.Unassigned(assignment.Member, assignment.Group);
await AuditLogger.Group.MemberRemoved(assignment.Group, assignment.Member);
- _ = OUNotificationService.PostAsync(assignment.Member, NotificationType.GroupAssignment, target: Group);
+ _ = NotificationGenerationService.PostAsync(assignment.Member, NotificationType.GroupAssignment, CurrentUser.State, Group);
}
if (changes.Any(c => c.Field != "member"))
{
- _ = OUNotificationService.PostAsync(Group, NotificationType.Modify);
+ _ = NotificationGenerationService.PostAsync(Group, NotificationType.Modify, CurrentUser.State);
await AuditLogger.Group.Changed(Group, changes.Where(c => c.Field != ActiveDirectoryFields.MemberOf.FieldName).ToList());
}
//await AuditLogger.Group.Changed(Group, Group.Changes);
@@ -205,7 +205,7 @@
Group.Delete();
SnackBarService.Success(Group.CanonicalName + " has been deleted.");
await AuditLogger.Group.Deleted(Group);
- _ = OUNotificationService.PostAsync(Group, NotificationType.Delete);
+ _ = NotificationGenerationService.PostAsync(Group, NotificationType.Delete, CurrentUser.State);
//Group = null;
Nav.NavigateTo("/groups/search");
diff --git a/BLAZAM/Pages/Login.razor b/BLAZAM/Pages/Login.razor
index 0ebc4f7aa..6c38d2271 100644
--- a/BLAZAM/Pages/Login.razor
+++ b/BLAZAM/Pages/Login.razor
@@ -89,11 +89,7 @@
-
- @**@
-
+
diff --git a/BLAZAM/Pages/OU/ConfirmNewOU.razor b/BLAZAM/Pages/OU/ConfirmNewOU.razor
index 59de0d9dc..e004b666f 100644
--- a/BLAZAM/Pages/OU/ConfirmNewOU.razor
+++ b/BLAZAM/Pages/OU/ConfirmNewOU.razor
@@ -1,5 +1,5 @@
@inherits AppComponentBase
-@inject OUNotificationService OUNotificationService
+@inject NotificationGenerationService OUNotificationService
Confirm OU Creation
@@ -30,7 +30,7 @@
await OU.CommitChangesAsync();
SnackBarService.Success("OU created");
await AuditLogger.OU.Created(OU);
- _ = OUNotificationService.PostAsync(OU, NotificationType.Create);
+ _ = OUNotificationService.PostAsync(OU, NotificationType.Create, CurrentUser.State);
await Confirmed.InvokeAsync(OU);
Nav.NavigateTo("/ou/create",true);
}
diff --git a/BLAZAM/Pages/OU/CreateOU.razor b/BLAZAM/Pages/OU/CreateOU.razor
index a9be162a4..623bacf15 100644
--- a/BLAZAM/Pages/OU/CreateOU.razor
+++ b/BLAZAM/Pages/OU/CreateOU.razor
@@ -1,49 +1,37 @@
@page "/ou/create"
@inherits TabbedAppComponentBase
@attribute [Authorize]
+@AppLocalization["Create OU"]
-Create OU
-
-
-
-
-
+
+
+
+
+
-
- @*
- @context.Name
- *@
-
+
-
+ Next
+
+
+
+ Create
+
+
+
+
+
+
+
+
+
+ Confirm
+
+
+
-
-
-
-
-
-
- Next
-
-
-
- Create
-
-
-
-
-
-
-
-
-
- Confirm
-
-
-
-
@@ -53,11 +41,6 @@
int selectedStep;
-
-
-
-
-
string newOUName;
IADOrganizationalUnit? parentOU;
IADOrganizationalUnit? newOU;
@@ -101,7 +84,7 @@
async void CreateNewOU()
{
LoadingData = true;
- await InvokeAsync(StateHasChanged);
+
newOU = parentOU?.CreateOU(newOUName);
@@ -109,7 +92,7 @@
selectedStep = 1;
- LoadingData = true;
+ LoadingData = false;
await InvokeAsync(StateHasChanged);
}
diff --git a/BLAZAM/Pages/OU/ViewOU.razor b/BLAZAM/Pages/OU/ViewOU.razor
index 6f46faa83..732ee10ed 100644
--- a/BLAZAM/Pages/OU/ViewOU.razor
+++ b/BLAZAM/Pages/OU/ViewOU.razor
@@ -1,5 +1,4 @@
@inherits DirectoryEntryViewBase
-@inject OUNotificationService OUNotificationService
@OU?.CanonicalName
@@ -11,9 +10,7 @@
OnMove="@(()=>{MoveToModal?.ShowAsync();})"
OnRename="@(()=>{RenameModal?.ShowAsync();})"
OnToggleEditMode="ToggleEditMode" />
-
-
-
+
@@ -89,21 +86,27 @@
}
async void SaveChanges()
{
- if (await MessageService.Confirm("Are you sure you want to save the changes?", "Save Changes"))
+ if (OU != null)
{
- var changes = OU?.Changes;
- await OU.CommitChangesAsync();
- EditMode = false;
- //Nav.WarnOnNavigation = false;
- await AuditLogger.OU.Changed(OU, changes);
- _ = OUNotificationService.PostAsync(OU, NotificationType.Modify);
+ if (await MessageService.Confirm("Are you sure you want to save the changes?", "Save Changes"))
+ {
+ var changes = OU?.Changes;
+ await OU.CommitChangesAsync();
+ EditMode = false;
+ //Nav.WarnOnNavigation = false;
+ await AuditLogger.OU.Changed(OU, changes);
+ _ = NotificationGenerationService.PostAsync(OU, NotificationType.Modify, CurrentUser.State);
- SnackBarService.Success("The changes made to this ou have been saved.");
- await RefreshEntryComponents();
+ SnackBarService.Success(AppLocalization["The changes made to this ou have been saved."]);
+ await RefreshEntryComponents();
+ }
+ }
+ else
+ {
+ SnackBarService.Error("OU is null");
}
-
}
void ChildClicked(DataGridRowClickEventArgs args)
{
@@ -118,7 +121,7 @@
OU.Delete();
SnackBarService.Success(OU.CanonicalName + " has been deleted.");
await AuditLogger.OU.Deleted(OU);
- _ = OUNotificationService.PostAsync(OU, NotificationType.Delete);
+ _ = NotificationGenerationService.PostAsync(OU, NotificationType.Delete, CurrentUser.State);
Nav.NavigateTo("/ou/search");
diff --git a/BLAZAM/Pages/Printers/ViewPrinter.razor b/BLAZAM/Pages/Printers/ViewPrinter.razor
index a978c09d2..518bb6994 100644
--- a/BLAZAM/Pages/Printers/ViewPrinter.razor
+++ b/BLAZAM/Pages/Printers/ViewPrinter.razor
@@ -16,9 +16,7 @@
OnMove="@(()=>{MoveToModal?.ShowAsync();})"
OnRename="@(()=>{RenameModal?.ShowAsync();})"
OnToggleEditMode="ToggleEditMode" />
-
-
-
+
@@ -93,9 +91,7 @@
}
}
-
-
-
+
diff --git a/BLAZAM/Pages/Recycle Bin/RecycleBin.razor b/BLAZAM/Pages/Recycle Bin/RecycleBin.razor
index d23ec17d0..5de689e1f 100644
--- a/BLAZAM/Pages/Recycle Bin/RecycleBin.razor
+++ b/BLAZAM/Pages/Recycle Bin/RecycleBin.razor
@@ -1,8 +1,8 @@
@page "/recyclebin"
@inherits AppComponentBase
@attribute [Authorize(Roles = UserRoles.SuperAdmin)]
+@AppLocalization["Recycle Bin"]
-Recycle Bin
Confirm User Creation
@@ -285,7 +285,7 @@ else
confirmed = true;
await Confirmed.InvokeAsync();
await AuditLogger.User.Created(User);
- _ = OUNotificationService.PostAsync(User, NotificationType.Create);
+ _ = OUNotificationService.PostAsync(User, NotificationType.Create, CurrentUser.State);
try
{
diff --git a/BLAZAM/Pages/Users/CreateUser.razor b/BLAZAM/Pages/Users/CreateUser.razor
index bef809d44..e7e962ec4 100644
--- a/BLAZAM/Pages/Users/CreateUser.razor
+++ b/BLAZAM/Pages/Users/CreateUser.razor
@@ -6,7 +6,8 @@
{
}
-Create User
+@AppLocalization["Create User"]
+
-
+
-
}
-
-
-
-
-
-
-
- @if (MoveToModal?.IsShown == true)
- {
-
- }
-
-
- @if (RenameModal?.IsShown == true)
- {
- {Renamed(renamedUser);}) User="User" />
- }
-
-
- @if (ChangePasswordModal?.IsShown == true)
- {
-
- }
-
-
- @if (LogOnToModal?.IsShown == true)
- {
-
- }
-
-
- @if (LogonHoursModal?.IsShown == true)
- {
-
- }
-
+
+
+
+
+
+
+
+ @if (MoveToModal?.IsShown == true)
+ {
+
+ }
+
+
+ @if (RenameModal?.IsShown == true)
+ {
+ {Renamed(renamedUser);}) User="User" />
+ }
+
+
+ @if (ChangePasswordModal?.IsShown == true)
+ {
+
+ }
+
+
+ @if (LogOnToModal?.IsShown == true)
+ {
+
+ }
+
+
+ @if (LogonHoursModal?.IsShown == true)
+ {
+
+ }
+
-
-
+
+
-
+
- {showRemoveThumbnail=true;})
- @onmouseleave=@(()=>{showRemoveThumbnail=false;})>
+ {showRemoveThumbnail=true;})
+ @onmouseleave=@(()=>{showRemoveThumbnail=false;})>
- @if (User?.ThumbnailPhoto != null)
+ @if (User?.ThumbnailPhoto != null)
+ {
+
+ @if (showRemoveThumbnail && CanEditField(ActiveDirectoryFields.Thumbnail))
{
-
- @if (showRemoveThumbnail && User.CanEditField(ActiveDirectoryFields.Thumbnail))
- {
-
-
- }
+
}
- else
- {
-
- }
- @if (showRemoveThumbnail && User?.CanEditField(ActiveDirectoryFields.Thumbnail) == true)
- {
- {UploadThumbnailModal?.ShowAsync();})
- Style="position:absolute !important;width:40px;height:40px;padding:2px;top:10px;right:10px"
- Color=Color.Primary
- Icon="@Icons.Material.Filled.Upload" />
- }
-
+ }
+ else
+ {
+
-
- @AppLocalization["Created"]:
-
-
+ }
+ @if (showRemoveThumbnail && User?.CanEditField(ActiveDirectoryFields.Thumbnail) == true)
+ {
+ {UploadThumbnailModal?.ShowAsync();})
+ Style="position:absolute !important;width:40px;height:40px;padding:2px;top:10px;right:10px"
+ Color=Color.Primary
+ Icon="@Icons.Material.Filled.Upload" />
+ }
+
-
+
+ @AppLocalization["Created"]:
+
+
-
+
- @AppLocalization["Last Change"]:
-
+
-
+ @AppLocalization["Last Change"]:
+
-
+
-
+
- @AppLocalization["Pass Change"]:
-
-
+
+ @AppLocalization["Pass Change"]:
+
+
-
-
+
- @AppLocalization["Last Logon"]:
-
-
-
- @if (User?.LockedOut == true)
- {
-
- @AppLocalization["Lockout Time"]:
-
-
-
- }
+
+
+ @AppLocalization["Last Logon"]:
+
+
+
+ @if (User?.LockedOut == true)
+ {
- @AppLocalization["OU"]:
+ @AppLocalization["Lockout Time"]:
-
- @User?.OU.ToPrettyOu()
+
+ }
+
+ @AppLocalization["OU"]:
+
+ @User?.OU.ToPrettyOu()
+
-
- @AppLocalization["Groups"]:
- {AssignToModal?.ShowAsync();}) Model="User" />
-
-
- @if (User.Disabled)
- {
- @AppLocalization["User is disabled"]
- }
- @if (User.LockedOut)
- {
- @AppLocalization["User is locked out"]
- }
-
-
-
-
+ @AppLocalization["Groups"]:
+ {AssignToModal?.ShowAsync();}) Model="User" />
+
-
+ @if (User.Disabled)
+ {
+ @AppLocalization["User is disabled"]
+ }
+ @if (User.LockedOut)
+ {
+ @AppLocalization["User is locked out"]
+ }
-
+
+
+
+
+
-
-
+
-
-
+
+
-
- @if (EditMode && User?.NewEntry == false)
- {
-
- To modify the user's name click the rename button in the toolbar/gear menu
-
- }
-
+
+
-
+ @if (EditMode && User?.NewEntry == false)
+ {
+
+ To modify the user's name click the rename button in the toolbar/gear menu
+
+ }
+
-
+
+
-
-
-
-
+
+
+
- @if (User?.NewEntry == true)
- {
-
-
-
- }
+
-
-
-
-
+ @if (User?.NewEntry == true)
+ {
+
+
+
+ }
+
+
+
- @if (User.CanReadField(ActiveDirectoryFields.AccountExpires))
- {
-
+
- }
-
+ @if (CanReadField(ActiveDirectoryFields.AccountExpires))
+ {
+
+
- @if (User.CanReadField(ActiveDirectoryFields.LogOnTo))
- {
-
- @AppLocalization["Log On To"]
-
+ }
- }
+
- @if (User.CanReadField(ActiveDirectoryFields.LogonHours))
- {
-
- @AppLocalization["Logon Hours"]
-
+ @if (CanReadField(ActiveDirectoryFields.LogOnTo))
+ {
+
+ @AppLocalization["Log On To"]
+
- }
-
+ }
+ @if (CanReadField(ActiveDirectoryFields.LogonHours))
+ {
+
+ @AppLocalization["Logon Hours"]
+
+ }
+ @if (User.CanSetPassword)
+ {
+
+
+ }
- @if (EditMode && !User.NewEntry)
- {
-
- To modify the account name or email click the rename button in the toolbar/gear menu
-
+
+ @if (EditMode && !User.NewEntry)
+ {
- }
-
+
+ To modify the account name or email click the rename button in the toolbar/gear menu
+
+ }
+
-
-
-
+
+
+
- @if (User.CanReadField(ActiveDirectoryFields.EmployeeId) ||
- User.CanReadField(ActiveDirectoryFields.Department) ||
- User.CanReadField(ActiveDirectoryFields.Company) ||
- User.CanReadField(ActiveDirectoryFields.Title) ||
- User.CanReadField(ActiveDirectoryFields.PhysicalDeliveryOffice)
- )
- {
-
-
- @if (User.CanReadField(ActiveDirectoryFields.Description))
- {
-
- }
- @if (User.CanReadField(ActiveDirectoryFields.EmployeeId))
- {
-
- }
- @if (User.CanReadField(ActiveDirectoryFields.Department))
- {
-
- }
- @if (User.CanReadField(ActiveDirectoryFields.Company))
- {
-
- }
- @if (User.CanReadField(ActiveDirectoryFields.Title))
- {
-
- }
- @if (User.CanReadField(ActiveDirectoryFields.PhysicalDeliveryOffice))
- {
-
- }
-
-
- }
- @if (User.CanReadField(ActiveDirectoryFields.HomePhone) ||
- User.CanReadField(ActiveDirectoryFields.StreetAddress) ||
- User.CanReadField(ActiveDirectoryFields.POBox) ||
- User.CanReadField(ActiveDirectoryFields.City) ||
- User.CanReadField(ActiveDirectoryFields.State) ||
- User.CanReadField(ActiveDirectoryFields.PostalCode)
- )
- {
-
-
+ @if (CanReadField(ActiveDirectoryFields.EmployeeId) ||
+ CanReadField(ActiveDirectoryFields.Department) ||
+ CanReadField(ActiveDirectoryFields.Company) ||
+ CanReadField(ActiveDirectoryFields.Title) ||
+ CanReadField(ActiveDirectoryFields.PhysicalDeliveryOffice)
+ )
+ {
+
+
- @if (User.CanReadField(ActiveDirectoryFields.HomePhone))
- {
-
+ @if (CanReadField(ActiveDirectoryFields.Description))
+ {
+
+ }
+ @if (CanReadField(ActiveDirectoryFields.EmployeeId))
+ {
+
+ }
+ @if (CanReadField(ActiveDirectoryFields.Department))
+ {
+
+ }
+ @if (CanReadField(ActiveDirectoryFields.Company))
+ {
+
+ }
+ @if (CanReadField(ActiveDirectoryFields.Title))
+ {
+
+ }
+ @if (CanReadField(ActiveDirectoryFields.PhysicalDeliveryOffice))
+ {
+
+ }
+
+
+ }
- }
- @if (User.CanReadField(ActiveDirectoryFields.StreetAddress))
- {
-
- }
- @if (User.CanReadField(ActiveDirectoryFields.POBox))
- {
-
- }
- @if (User.CanReadField(ActiveDirectoryFields.City))
- {
-
- }
- @if (User.CanReadField(ActiveDirectoryFields.State))
- {
-
- }
- @if (User.CanReadField(ActiveDirectoryFields.PostalCode))
- {
-
- }
-
+ @if (CanReadField(ActiveDirectoryFields.HomePhone) ||
+ CanReadField(ActiveDirectoryFields.StreetAddress) ||
+ CanReadField(ActiveDirectoryFields.POBox) ||
+ CanReadField(ActiveDirectoryFields.City) ||
+ CanReadField(ActiveDirectoryFields.State) ||
+ CanReadField(ActiveDirectoryFields.PostalCode)
+ )
+ {
+
- }
+ @if (CanReadField(ActiveDirectoryFields.HomePhone))
+ {
+
+ }
+ @if (CanReadField(ActiveDirectoryFields.StreetAddress))
+ {
+
+ }
+ @if (CanReadField(ActiveDirectoryFields.POBox))
+ {
+
+ }
+ @if (CanReadField(ActiveDirectoryFields.City))
+ {
+
+ }
+ @if (CanReadField(ActiveDirectoryFields.State))
+ {
+
+ }
+ @if (CanReadField(ActiveDirectoryFields.PostalCode))
+ {
+
+ }
+
- @if (User.CanReadField(ActiveDirectoryFields.HomeDirectory) ||
- User.CanReadField(ActiveDirectoryFields.HomeDrive) ||
- User.CanReadField(ActiveDirectoryFields.ScriptPath) ||
- User.CanReadField(ActiveDirectoryFields.ProfilePath)
- )
- {
-
+ }
- @if (User.CanReadField(ActiveDirectoryFields.HomeDirectory))
- {
-
-
- @if (!User.HomeDirectory.IsNullOrEmpty())
- {
+ @if (CanReadField(ActiveDirectoryFields.HomeDirectory) ||
+ CanReadField(ActiveDirectoryFields.HomeDrive) ||
+ CanReadField(ActiveDirectoryFields.ScriptPath) ||
+ CanReadField(ActiveDirectoryFields.ProfilePath)
+ )
+ {
+
+
-
- }
-
-
- }
- @if (User.CanReadField(ActiveDirectoryFields.HomeDrive))
- {
-
- }
- @if (User.CanReadField(ActiveDirectoryFields.ScriptPath))
- {
-
- }
- @if (User.CanReadField(ActiveDirectoryFields.ProfilePath))
- {
-
- }
-
+ @if (CanReadField(ActiveDirectoryFields.HomeDirectory))
+ {
+
-
- }
+
+ @if (!User.HomeDirectory.IsNullOrEmpty())
+ {
- @if (User.CanReadAnyCustomFields && CustomFields != null && CustomFields.Count > 0)
- {
-
+
+ }
+
+
+ }
+ @if (CanReadField(ActiveDirectoryFields.HomeDrive))
+ {
+
+ }
+ @if (CanReadField(ActiveDirectoryFields.ScriptPath))
+ {
+
+ }
+ @if (CanReadField(ActiveDirectoryFields.ProfilePath))
+ {
+
+ }
+
+
+
+ }
- @foreach (var field in CustomFields)
+ @if (User.CanReadAnyCustomFields && CustomFields != null && CustomFields.Count > 0)
+ {
+
+
+ @foreach (var field in CustomFields)
+ {
+ @if (CanReadField(field))
{
- @if (User.CanReadField(field))
- {
-
+
- }
}
+ }
-
- }
+
+ }
@@ -465,16 +491,15 @@
}
-
-
-
+
+
}
@code {
-#nullable disable warnings
+ #nullable disable warnings
string password;
[Parameter]
@@ -505,10 +530,78 @@
}
[Parameter]
public EventCallback ConfirmPasswordChanged { get; set; }
-
+ AccessLevel? selfAccessLevel;
bool homeDirectoryExists;
bool showRemoveThumbnail = false;
IADUser User => DirectoryEntry as IADUser;
+ GlobalPermissionSettings? _globalPermissionSettings;
+
+ private bool isSelf
+ {
+ get
+ {
+ if (_globalPermissionSettings != null)
+ {
+ if (selfAccessLevel != null)
+ {
+ return User.SamAccountName.Equals(CurrentUser.Username, StringComparison.InvariantCultureIgnoreCase);
+ }
+ }
+ return false;
+ }
+ }
+
+
+ private bool CanReadField(IActiveDirectoryField field)
+ {
+ if (!isSelf)
+ {
+ return User.CanReadField(field);
+ }
+ else
+ {
+ if (selfAccessLevel.FieldMap.Any(x => x.Field.Id == field.Id && x.FieldAccessLevel.Level > FieldAccessLevels.Deny.Level))
+ {
+ return true;
+ }
+ else if (selfAccessLevel.FieldMap.Any(x => x.CustomField.Id == field.Id && x.FieldAccessLevel.Level > FieldAccessLevels.Deny.Level))
+ {
+ return true;
+ }
+ else
+ {
+ return User.CanReadField(field);
+ }
+ }
+ }
+
+ private bool CanEditField(IActiveDirectoryField field)
+ {
+ if (!isSelf)
+ {
+ return User.CanEditField(field);
+ }
+ else
+ {
+ if (selfAccessLevel.FieldMap.Any(x => x.Field.Id == field.Id && x.FieldAccessLevel.Level > FieldAccessLevels.Read.Level))
+ {
+ return true;
+ }
+ else if (selfAccessLevel.FieldMap.Any(x => x.CustomField.Id == field.Id && x.FieldAccessLevel.Level > FieldAccessLevels.Read.Level))
+ {
+ return true;
+ }
+ else
+ {
+ return User.CanEditField(field);
+ }
+ }
+ }
+
+
+
+
+
protected override async Task OnInitializedAsync()
{
@@ -517,6 +610,16 @@
await InvokeAsync(StateHasChanged);
+
+
+ if (Context != null)
+ {
+ _globalPermissionSettings = Context.GlobalPermissionSettings.FirstOrDefault();
+
+ }
+ selfAccessLevel = Context.AccessLevels.FirstOrDefault(x => x.Name == AccessLevel.SelfAccessLevelName);
+
+
if (User.HomeDirectory != null)
{
try
@@ -545,7 +648,7 @@
async void SaveChanges()
{
- if (await MessageService.Confirm("Are you sure you want to save the changes?"))
+ if (await MessageService.Confirm(AppLocalization["Are you sure you want to save the changes?"]))
{
SavingChanges = true;
await RefreshEntryComponents();
@@ -563,7 +666,7 @@
{
await AuditLogger.User.Assigned(assignment.Member, assignment.Group);
await AuditLogger.Group.MemberAdded(assignment.Group, assignment.Member);
- _ = OUNotificationService.PostAsync(User, NotificationType.GroupAssignment,target:assignment.Group);
+ _ = NotificationGenerationService.PostAsync(User, NotificationType.GroupAssignment, CurrentUser.State, assignment.Group);
}
@@ -571,12 +674,12 @@
{
await AuditLogger.User.Unassigned(assignment.Member, assignment.Group);
await AuditLogger.Group.MemberRemoved(assignment.Group, assignment.Member);
- _ = OUNotificationService.PostAsync(User, NotificationType.GroupAssignment, target: assignment.Group);
+ _ = NotificationGenerationService.PostAsync(User, NotificationType.GroupAssignment, CurrentUser.State, assignment.Group);
}
if (changes.Any(c => c.Field != ActiveDirectoryFields.MemberOf.FieldName))
{
- _ = OUNotificationService.PostAsync(User, NotificationType.Modify);
+ _ = NotificationGenerationService.PostAsync(User, NotificationType.Modify, CurrentUser.State);
await AuditLogger.User.Changed(User, changes.Where(c => c.Field != ActiveDirectoryFields.MemberOf.FieldName).ToList());
}
@@ -626,7 +729,7 @@
SnackBarService.Success(User.DisplayName + " has been deleted.");
await AuditLogger.User.Deleted(User);
- _ = OUNotificationService.PostAsync(User, NotificationType.Delete);
+ _ = NotificationGenerationService.PostAsync(User, NotificationType.Delete, CurrentUser.State);
}
catch (ApplicationException ex)
diff --git a/BLAZAM/Program.cs b/BLAZAM/Program.cs
index f3d17541c..3a1b15b8c 100644
--- a/BLAZAM/Program.cs
+++ b/BLAZAM/Program.cs
@@ -172,7 +172,7 @@ public static void Main(string[] args)
AppInstance.Start();
GetRunningWebServerConfiguration();
- ScheduleAutoLoad();
+ //ScheduleAutoLoad();
AppInstance.WaitForShutdown();
Log.Information("Application Shutting Down");
diff --git a/BLAZAM/ProgramHelpers.cs b/BLAZAM/ProgramHelpers.cs
index 56b5f2de4..78face01b 100644
--- a/BLAZAM/ProgramHelpers.cs
+++ b/BLAZAM/ProgramHelpers.cs
@@ -129,7 +129,7 @@ public static WebApplicationBuilder InjectServices(this WebApplicationBuilder bu
* Uncomment this to force a language
- CultureInfo culture = new CultureInfo("ru");
+ CultureInfo culture = new CultureInfo("zh-Hans");
//CultureInfo culture = new CultureInfo("zh-Hans");
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
@@ -305,7 +305,7 @@ completed so it may not be usable as is
builder.Services.AddScoped();
- builder.Services.AddSingleton();
+ builder.Services.AddSingleton();
builder.Host.UseWindowsService();
@@ -338,7 +338,7 @@ private static void PreloadServices()
{
try
{
- var context = Program.AppInstance.Services.GetRequiredService();
+ var context = Program.AppInstance.Services.GetRequiredService();
}
catch (Exception ex)
{
diff --git a/BLAZAM/updater/update.ps1 b/BLAZAM/updater/update.ps1
index 21b141c40..0184c44db 100644
--- a/BLAZAM/updater/update.ps1
+++ b/BLAZAM/updater/update.ps1
@@ -62,6 +62,8 @@ $updateScript= {
if(!$global:iis){
Stop-Process -ID $global:processId -Force
+
+ Stop-Service -Name "Blazam" -Force -ErrorAction Continue
}
Start-Sleep -Seconds 15
@@ -74,56 +76,11 @@ $updateScript= {
Remove-Item -Path $global:destination\app_offline.htm -Force
if(!$global:iis){
- Write-Host("Process path: " + $global:processFilePath)
-
- if($global:processArguments -ne $null -and $global:processArguments -ne "")
- {
-
- Write-Host("Starting with arguments: " + $global:processArguments)
- $restartedProcess = Start-Process -FilePath $global:processFilePath -ArgumentList $global:processArguments -WorkingDirectory $global:destination -PassThru
+ Start-Service -Name "Blazam" -ErrorAction Continue
- }else{
- $restartedProcess = Start-Process -FilePath $global:processFilePath -WorkingDirectory $global:destination -PassThru
-
- }
Write-Host("Waiting 15 seconds for Application to restart")
Start-Sleep -Seconds 15
- <#
- Write-Host("Process Stats: "+($restartedProcess| Select-Object *))
- if ($restartedProcess.ExitTime -eq $null -or $global:iis) {
- Write-Host("Error: Web Application failed to restart rolling back changes")
- #Perform Rollback Section
- $restoreSource = $backupDirectory + "*"
- Write-Host("Rolling back update")
- Write-Host("Source: " + $restoreSource)
- Write-Host("Destination: " + $global:destination)
- Copy-Item -Path $restoreSource -Destination $backupDirectory -Recurse -Verbose -Force
- Write-Host("Restarting ApplicationPool")
-
- if($global:processArguments -ne $null -and $global:processArguments -ne "")
- {
-
- Write-Host("Starting with arguments: " + $global:processArguments)
- $restartedProcess = Start-Process -FilePath $global:processFilePath -ArgumentList $global:processArguments -PassThru
-
- }else{
- $restartedProcess = Start-Process -FilePath $global:processFilePath -PassThru
-
- }
- #$runningSite | Start-IISSite
- Write-Host("Waiting 15 seconds for Application to restart")
-
- Start-Sleep -Seconds 15
- if ($restartedProcess.ExitTime -eq $null) {
- Write-Host("Error: Rollback performed, but application did not start! Oh no...")
- }
- else {
- Write-Host("Rollback completed successfully")
- }
- Stop-Transcript
- exit
- }
- #>
+
}
diff --git a/BLAZAM/wwwroot/css/site.css b/BLAZAM/wwwroot/css/site.css
index 7c6d68a30..48bc83eee 100644
--- a/BLAZAM/wwwroot/css/site.css
+++ b/BLAZAM/wwwroot/css/site.css
@@ -8,6 +8,13 @@ html, body {
h1:focus {
outline: none;
}
+
+.badge-repos {
+ left: 37px !important;
+ top: 2px !important;
+}
+
+
.d-contents{
display:contents !important;
}
@@ -168,3 +175,5 @@ a, .btn-link {
top: 64px !important;
}
}
+
+
diff --git a/BLAZAMActiveDirectory/Adapters/ADOrganizationalUnit.cs b/BLAZAMActiveDirectory/Adapters/ADOrganizationalUnit.cs
index 49e0ccc1a..9082141ac 100644
--- a/BLAZAMActiveDirectory/Adapters/ADOrganizationalUnit.cs
+++ b/BLAZAMActiveDirectory/Adapters/ADOrganizationalUnit.cs
@@ -267,7 +267,7 @@ public IADUser CreateUser(string containerName)
/// Directory.
///
/// The container name of the new group
- /// An uncommited group
+ /// An uncommitted group
public IADGroup CreateGroup(string containerName)
{
EnsureDirectoryEntry();
diff --git a/BLAZAMActiveDirectory/Adapters/AccountDirectoryAdapter.cs b/BLAZAMActiveDirectory/Adapters/AccountDirectoryAdapter.cs
index 46dce2d27..08e69f031 100644
--- a/BLAZAMActiveDirectory/Adapters/AccountDirectoryAdapter.cs
+++ b/BLAZAMActiveDirectory/Adapters/AccountDirectoryAdapter.cs
@@ -35,6 +35,7 @@ public class AccountDirectoryAdapter : GroupableDirectoryAdapter, IAccountDirect
public virtual bool CanUnlock { get => HasActionPermission(ObjectActions.Unlock); }
+
public bool CanSearchDisabled
{
get
diff --git a/BLAZAMActiveDirectory/Adapters/DirectoryEntryAdapter.cs b/BLAZAMActiveDirectory/Adapters/DirectoryEntryAdapter.cs
index fe3706fca..ed8b7a3ad 100644
--- a/BLAZAMActiveDirectory/Adapters/DirectoryEntryAdapter.cs
+++ b/BLAZAMActiveDirectory/Adapters/DirectoryEntryAdapter.cs
@@ -20,6 +20,7 @@
using System.Linq;
using System.Reflection;
using System.Web;
+using static MudBlazor.Colors;
namespace BLAZAM.ActiveDirectory.Adapters
{
@@ -54,6 +55,10 @@ public virtual List Changes
get
{
List changes = new();
+
+
+
+
foreach (var prop in NewEntryProperties)
{
object? currentValue = null;
@@ -639,9 +644,13 @@ public virtual IEnumerable Children
List directoryEntries = new List();
var children = DirectoryEntry.Children;
DirectoryEntryAdapter? thisObject = null;
+ var list = new List();
foreach (DirectoryEntry child in children)
{
-
+ list.Add(child);
+ }
+ Parallel.ForEach(list, child =>
+ {
if (child.Properties["objectClass"].Contains("top"))
{
var objectClass = child.Properties["objectClass"];
@@ -673,14 +682,58 @@ public virtual IEnumerable Children
if (thisObject != null)
{
thisObject.Parse(directory: Directory, directoryEntry: child);
- directoryEntries.Add(thisObject);
+ lock (directoryEntries)
+ {
+ directoryEntries.Add(thisObject);
+ }
}
}
thisObject = null;
+ });
+ //foreach (DirectoryEntry child in children)
+ //{
- }
+ // if (child.Properties["objectClass"].Contains("top"))
+ // {
+ // var objectClass = child.Properties["objectClass"];
+ // if (objectClass.Contains("computer"))
+ // {
+ // thisObject = new ADComputer();
+ // }
+ // else if (objectClass.Contains("user"))
+ // {
+ // thisObject = new ADUser();
+ // }
+ // else if (objectClass.Contains("organizationalUnit"))
+ // {
+ // thisObject = new ADOrganizationalUnit();
+ // }
+ // else if (objectClass.Contains("group"))
+ // {
+ // thisObject = new ADGroup();
+ // }
+ // else if (objectClass.Contains("printQueue"))
+ // {
+ // thisObject = new ADPrinter();
+ // }
+
+ // else if (objectClass.Contains("msFVE-RecoveryInformation"))
+ // {
+ // thisObject = new ADBitLockerRecovery();
+ // }
+ // if (thisObject != null)
+ // {
+ // thisObject.Parse(directory: Directory, directoryEntry: child);
+ // directoryEntries.Add(thisObject);
+
+ // }
+
+ // }
+ // thisObject = null;
+
+ //}
directoryEntries.OrderBy(x => x.CanonicalName).OrderBy(x => x.ObjectType);
CachedChildren = directoryEntries;
}
@@ -1027,11 +1080,45 @@ private void FetchDirectoryEntry()
}
}
+ //protected virtual List GetNonReplicatedProperty(string propertyName)
+ //{
+ // var list = new List();
+ // var dcs = new List(Directory.DomainControllers);
+ // foreach (var dc in dcs)
+ // {
+ // try
+ // {
+ // if (dc.IsPingable())
+ // {
+ // var searcher = dc.GetDirectorySearcher();
+ // searcher.Filter = "(distinguishedName=" + this.DN + ")";
+ // searcher.ClientTimeout = TimeSpan.FromMilliseconds(500);
+ // searcher.ServerTimeLimit = TimeSpan.FromMilliseconds(500);
+ // var searchResult = searcher.FindOne();
+ // if (searchResult != null)
+ // {
+ // var value = searchResult.GetDirectoryEntry().Properties[propertyName].Value;
+
+ // list.Add((T)value);
+ // }
+
+ // }
+ // }
+ // catch
+ // {
+ // //list.Add(default(T));
+ // }
+ // }
+ // return list;
+ //}
+
+
protected virtual List GetNonReplicatedProperty(string propertyName)
{
var list = new List();
var dcs = new List(Directory.DomainControllers);
- foreach (var dc in dcs)
+
+ Parallel.ForEach(dcs, dc =>
{
try
{
@@ -1045,20 +1132,27 @@ private void FetchDirectoryEntry()
if (searchResult != null)
{
var value = searchResult.GetDirectoryEntry().Properties[propertyName].Value;
-
- list.Add((T)value);
+ lock (list)
+ {
+ list.Add((T)value);
+ }
}
-
}
}
catch
{
- //list.Add(default(T));
+ // Consider logging the exception or handling it appropriately.
+ lock (list)
+ {
+ list.Add(default(T));
+ }
}
- }
+ });
+
return list;
}
+
protected virtual T? GetProperty(string propertyName)
{
try
diff --git a/BLAZAMActiveDirectory/Interfaces/IAccountDirectoryAdapter.cs b/BLAZAMActiveDirectory/Interfaces/IAccountDirectoryAdapter.cs
index 5d2260a23..00027fd69 100644
--- a/BLAZAMActiveDirectory/Interfaces/IAccountDirectoryAdapter.cs
+++ b/BLAZAMActiveDirectory/Interfaces/IAccountDirectoryAdapter.cs
@@ -38,6 +38,11 @@ public interface IAccountDirectoryAdapter : IGroupableDirectoryAdapter
///
bool Enabled { get; set; }
+ ///
+ /// Indicates whether the current web user can reset the password for this
+ ///
+ bool CanSetPassword { get; }
+
///
/// Indicates whether the current web user can search disabled 's
///
diff --git a/BLAZAMCommon/Helpers/CommonHelpers.cs b/BLAZAMCommon/Helpers/CommonHelpers.cs
index 540739358..78099eeb7 100644
--- a/BLAZAMCommon/Helpers/CommonHelpers.cs
+++ b/BLAZAMCommon/Helpers/CommonHelpers.cs
@@ -362,7 +362,18 @@ public static string ToSidString(this byte[] sid)
return securityIdentifier.Value;
}
+ public static byte[] ToSidByteArray(this string sidString)
+ {
+ if (string.IsNullOrEmpty(sidString)) return Array.Empty();
+
+ var securityIdentifier = new SecurityIdentifier(sidString);
+ // Use GetBinaryForm method with appropriate buffer size
+ byte[] sidBytes = new byte[securityIdentifier.BinaryLength];
+ securityIdentifier.GetBinaryForm(sidBytes, 0);
+
+ return sidBytes;
+ }
#endregion
}
diff --git a/BLAZAMDatabase/Context/AppDatabaseFactory.cs b/BLAZAMDatabase/Context/AppDatabaseFactory.cs
index 26ce97c9e..54ef4025e 100644
--- a/BLAZAMDatabase/Context/AppDatabaseFactory.cs
+++ b/BLAZAMDatabase/Context/AppDatabaseFactory.cs
@@ -60,6 +60,9 @@ private void SeedData()
SetupDenyAll(seedContext);
+
+ //EnsureGlobalPermissionSettingsExists(seedContext);
+
}
diff --git a/BLAZAMDatabase/Context/DatabaseContextBase.cs b/BLAZAMDatabase/Context/DatabaseContextBase.cs
index cb13536d0..5e0487973 100644
--- a/BLAZAMDatabase/Context/DatabaseContextBase.cs
+++ b/BLAZAMDatabase/Context/DatabaseContextBase.cs
@@ -139,6 +139,8 @@ public DatabaseContextBase(DbContextOptions options) : base(options)
public virtual DbSet PermissionDelegate { get; set; }
public virtual DbSet PermissionMap { get; set; }
+ public virtual DbSet GlobalPermissionSettings { get; set; }
+ public virtual DbSet GlobalPermissionRequestActions { get; set; }
public virtual DbSet ChatRooms { get; set; }
public virtual DbSet ChatMessages { get; set; }
@@ -527,7 +529,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
new ObjectAction() { Id = 6, Name = "Rename", Action = ActiveDirectoryObjectAction.Rename },
new ObjectAction() { Id = 7, Name = "Move", Action = ActiveDirectoryObjectAction.Move },
new ObjectAction() { Id = 8, Name = "Create", Action = ActiveDirectoryObjectAction.Create },
- new ObjectAction() { Id = 9, Name = "Delete", Action = ActiveDirectoryObjectAction.Delete }
+ new ObjectAction() { Id = 9, Name = "Delete", Action = ActiveDirectoryObjectAction.Delete },
+ new ObjectAction() { Id = 10, Name = "Set Password", Action = ActiveDirectoryObjectAction.SetPassword }
);
modelBuilder.Entity(entity =>
diff --git a/BLAZAMDatabase/Context/IDatabaseContext.cs b/BLAZAMDatabase/Context/IDatabaseContext.cs
index b39d6aca1..1ad358357 100644
--- a/BLAZAMDatabase/Context/IDatabaseContext.cs
+++ b/BLAZAMDatabase/Context/IDatabaseContext.cs
@@ -64,6 +64,8 @@ public interface IDatabaseContext : IEFCoreDbContext
DbSet UnreadChatMessages { get; set; }
DbSet ActiveDirectoryFieldObjectMappings { get; set; }
DbSet NotificationSubscriptions { get; set; }
+ DbSet GlobalPermissionSettings { get; set; }
+ DbSet GlobalPermissionRequestActions { get; set; }
void Export(string directory);
}
diff --git a/BLAZAMDatabase/Helpers/DatabaseHelpers.cs b/BLAZAMDatabase/Helpers/DatabaseHelpers.cs
index a9adca3da..eea940221 100644
--- a/BLAZAMDatabase/Helpers/DatabaseHelpers.cs
+++ b/BLAZAMDatabase/Helpers/DatabaseHelpers.cs
@@ -1,4 +1,6 @@
-using BLAZAM.Database.Models.User;
+using BLAZAM.Common.Data;
+using BLAZAM.Database.Models.Permissions;
+using BLAZAM.Database.Models.User;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -18,5 +20,132 @@ public static long GetMembersHash(this IEnumerable members)
}
return hash;
}
+ public static List ToList(this ActiveDirectoryObjectAction _enum)
+ {
+ return Enum.GetValues(typeof(ActiveDirectoryObjectAction)).Cast().ToList();
+ }
+
+ public static bool IsActionAppropriateForObject(this ActiveDirectoryObjectAction action, ActiveDirectoryObjectType type)
+ {
+
+ var Name = action.ToString();
+ switch (type)
+ {
+ case ActiveDirectoryObjectType.User:
+ case ActiveDirectoryObjectType.Computer:
+ switch (Name)
+ {
+ case "Lock":
+ case "Unlock":
+ case "Move":
+ case "Delete":
+ case "Create":
+ case "Enable":
+ case "Disable":
+ case "Rename":
+ case "SetPassword":
+ return true;
+ default:
+ return false;
+ }
+ case ActiveDirectoryObjectType.Group:
+ switch (Name)
+ {
+ case "Move":
+ case "Delete":
+ case "Create":
+ case "Unassign":
+ case "Rename":
+ case "Assign":
+ return true;
+ default:
+ return false;
+ }
+ case ActiveDirectoryObjectType.Printer:
+ case ActiveDirectoryObjectType.OU:
+ switch (Name)
+ {
+ case "Move":
+ case "Delete":
+ case "Rename":
+ case "Create":
+ return true;
+ default:
+ return false;
+ }
+ case ActiveDirectoryObjectType.BitLocker:
+ switch (Name)
+ {
+ case "Delete":
+ return true;
+ default:
+ return false;
+ }
+
+ default:
+ return false;
+ }
+ }
+
+ public static bool IsActionAppropriateForObject(this ObjectAction action, ActiveDirectoryObjectType type)
+ {
+ var Name = action.Name;
+ switch (type)
+ {
+ case ActiveDirectoryObjectType.User:
+ case ActiveDirectoryObjectType.Computer:
+ switch (Name)
+ {
+ case "Lock":
+ case "Unlock":
+ case "Move":
+ case "Delete":
+ case "Create":
+ case "Enable":
+ case "Disable":
+ case "Rename":
+ case "Set Password":
+ return true;
+ default:
+ return false;
+ }
+ case ActiveDirectoryObjectType.Group:
+ switch (Name)
+ {
+ case "Move":
+ case "Delete":
+ case "Create":
+ case "UnAssign":
+ case "Rename":
+ case "Assign":
+ return true;
+ default:
+ return false;
+ }
+ case ActiveDirectoryObjectType.Printer:
+ case ActiveDirectoryObjectType.OU:
+ switch (Name)
+ {
+ case "Move":
+ case "Delete":
+ case "Rename":
+ case "Create":
+ return true;
+ default:
+ return false;
+ }
+ case ActiveDirectoryObjectType.BitLocker:
+ switch (Name)
+ {
+ case "Delete":
+ return true;
+ default:
+ return false;
+ }
+
+ default:
+ return false;
+ }
+ }
}
}
diff --git a/BLAZAMDatabase/Helpers/WindowsHelpers.cs b/BLAZAMDatabase/Helpers/WindowsHelpers.cs
index e312a5822..dc272085c 100644
--- a/BLAZAMDatabase/Helpers/WindowsHelpers.cs
+++ b/BLAZAMDatabase/Helpers/WindowsHelpers.cs
@@ -6,6 +6,30 @@ namespace BLAZAM.Helpers
{
public static class WindowsHelpers
{
+ public static WindowsImpersonationUser GetDirectoryImpersonationUser(this ADSettings settings)
+ {
+
+ return new WindowsImpersonationUser()
+ {
+ FQDN = settings.FQDN,
+ Username = settings.Username,
+
+ Password = settings.Password.Decrypt().ToSecureString(),
+ };
+
+ }
+ public static WindowsImpersonationUser GetUpdateImpersonationUser(this AppSettings settings)
+ {
+
+ return new WindowsImpersonationUser()
+ {
+ FQDN = settings.UpdateDomain,
+ Username = settings.UpdateUsername,
+ Password = settings.UpdatePassword.Decrypt().ToSecureString()
+ };
+
+ }
+
///
/// Creates a windows identity from the active directory
/// user defined in settings
@@ -14,13 +38,7 @@ public static class WindowsHelpers
///
public static WindowsImpersonation CreateDirectoryAdminImpersonator(this ADSettings settings)
{
- return new(new()
- {
- FQDN = settings.FQDN,
- Username = settings.Username,
-
- Password = settings.Password.Decrypt().ToSecureString(),
- });
+ return new(settings.GetDirectoryImpersonationUser());
}
///
/// Creates a windows identity from the update settins
@@ -30,12 +48,7 @@ public static WindowsImpersonation CreateDirectoryAdminImpersonator(this ADSetti
public static WindowsImpersonation? CreateUpdateImpersonator(this AppSettings settings)
{
if (settings != null && settings.UpdateUsername != null && settings.UpdatePassword != null)
- return new(new()
- {
- FQDN = settings.UpdateDomain,
- Username = settings.UpdateUsername,
- Password = settings.UpdatePassword.Decrypt().ToSecureString()
- });
+ return new(settings.GetUpdateImpersonationUser());
else
return null;
}
diff --git a/BLAZAMDatabase/Migrations/MySql/20241031220141_Add_Set_Password_Action_MySql.Designer.cs b/BLAZAMDatabase/Migrations/MySql/20241031220141_Add_Set_Password_Action_MySql.Designer.cs
new file mode 100644
index 000000000..e8af60f6c
--- /dev/null
+++ b/BLAZAMDatabase/Migrations/MySql/20241031220141_Add_Set_Password_Action_MySql.Designer.cs
@@ -0,0 +1,1978 @@
+//
+using System;
+using BLAZAM.Database.Context;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace BLAZAM.Database.Migrations.MySql
+{
+ [DbContext(typeof(MySqlDatabaseContext))]
+ [Migration("20241031220141_Add_Set_Password_Action_MySql")]
+ partial class Add_Set_Password_Action_MySql
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.10")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
+
+ modelBuilder.Entity("AccessLevelFieldAccessMapping", b =>
+ {
+ b.Property("AccessLevelsId")
+ .HasColumnType("int");
+
+ b.Property("FieldMapId")
+ .HasColumnType("int");
+
+ b.HasKey("AccessLevelsId", "FieldMapId");
+
+ b.HasIndex("FieldMapId");
+
+ b.ToTable("AccessLevelFieldAccessMapping");
+ });
+
+ modelBuilder.Entity("AccessLevelObjectAccessMapping", b =>
+ {
+ b.Property("AccessLevelsId")
+ .HasColumnType("int");
+
+ b.Property("ObjectMapId")
+ .HasColumnType("int");
+
+ b.HasKey("AccessLevelsId", "ObjectMapId");
+
+ b.HasIndex("ObjectMapId");
+
+ b.ToTable("AccessLevelObjectAccessMapping");
+ });
+
+ modelBuilder.Entity("AccessLevelPermissionMapping", b =>
+ {
+ b.Property("AccessLevelsId")
+ .HasColumnType("int");
+
+ b.Property("PermissionMapsId")
+ .HasColumnType("int");
+
+ b.HasKey("AccessLevelsId", "PermissionMapsId");
+
+ b.HasIndex("PermissionMapsId");
+
+ b.ToTable("AccessLevelPermissionMapping");
+ });
+
+ modelBuilder.Entity("AppUserChatRoom", b =>
+ {
+ b.Property("ChatRoomId")
+ .HasColumnType("int");
+
+ b.Property("MembersId")
+ .HasColumnType("int");
+
+ b.HasKey("ChatRoomId", "MembersId");
+
+ b.HasIndex("MembersId");
+
+ b.ToTable("AppUserChatRoom");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.ADSettings", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("int");
+
+ b.Property("ApplicationBaseDN")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("FQDN")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ServerAddress")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ServerPort")
+ .HasColumnType("int");
+
+ b.Property("UseTLS")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("ActiveDirectorySettings", t =>
+ {
+ t.HasCheckConstraint("CK_Table_Column", "Id = 1");
+ });
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.ActiveDirectoryField", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("FieldName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("FieldType")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("ActiveDirectoryFields");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ DisplayName = "Last Name",
+ FieldName = "sn",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 2,
+ DisplayName = "First Name",
+ FieldName = "givenname",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 3,
+ DisplayName = "Office",
+ FieldName = "physicalDeliveryOfficeName",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 4,
+ DisplayName = "Employee ID",
+ FieldName = "employeeId",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 5,
+ DisplayName = "Home Directory",
+ FieldName = "homeDirectory",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 6,
+ DisplayName = "Logon Script Path",
+ FieldName = "scriptPath",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 7,
+ DisplayName = "Profile Path",
+ FieldName = "profilePath",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 8,
+ DisplayName = "Home Phone Number",
+ FieldName = "homePhone",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 9,
+ DisplayName = "Street Address",
+ FieldName = "streetAddress",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 10,
+ DisplayName = "City",
+ FieldName = "l",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 11,
+ DisplayName = "State",
+ FieldName = "st",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 12,
+ DisplayName = "Zip Code",
+ FieldName = "postalCode",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 13,
+ DisplayName = "Site",
+ FieldName = "site",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 14,
+ DisplayName = "Name",
+ FieldName = "name",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 15,
+ DisplayName = "Username",
+ FieldName = "samaccountname",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 16,
+ DisplayName = "SID",
+ FieldName = "objectSID",
+ FieldType = 2
+ },
+ new
+ {
+ Id = 17,
+ DisplayName = "E-Mail Address",
+ FieldName = "mail",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 18,
+ DisplayName = "Description",
+ FieldName = "description",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 19,
+ DisplayName = "Display Name",
+ FieldName = "displayName",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 20,
+ DisplayName = "Distinguished Name",
+ FieldName = "distinguishedName",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 21,
+ DisplayName = "Member Of",
+ FieldName = "memberOf",
+ FieldType = 4
+ },
+ new
+ {
+ Id = 22,
+ DisplayName = "Company",
+ FieldName = "company",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 23,
+ DisplayName = "Title",
+ FieldName = "title",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 24,
+ DisplayName = "User Principal Name",
+ FieldName = "userPrincipalName",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 25,
+ DisplayName = "Telephone Number",
+ FieldName = "telephoneNumber",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 26,
+ DisplayName = "PO Box",
+ FieldName = "postOfficeBox",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 27,
+ DisplayName = "Canonical Name",
+ FieldName = "cn",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 28,
+ DisplayName = "Home Drive",
+ FieldName = "homeDrive",
+ FieldType = 3
+ },
+ new
+ {
+ Id = 29,
+ DisplayName = "Department",
+ FieldName = "department",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 30,
+ DisplayName = "Middle Name",
+ FieldName = "middleName",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 31,
+ DisplayName = "Pager",
+ FieldName = "pager",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 32,
+ DisplayName = "OS",
+ FieldName = "operatingSystemVersion",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 33,
+ DisplayName = "Account Expiration",
+ FieldName = "accountExpires",
+ FieldType = 1
+ },
+ new
+ {
+ Id = 34,
+ DisplayName = "Manager",
+ FieldName = "manager",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 35,
+ DisplayName = "Photo",
+ FieldName = "thumbnail",
+ FieldType = 2
+ },
+ new
+ {
+ Id = 36,
+ DisplayName = "Log On To",
+ FieldName = "userWorkstations",
+ FieldType = 0
+ },
+ new
+ {
+ Id = 37,
+ DisplayName = "Logon Hours",
+ FieldName = "logonHours",
+ FieldType = 2
+ });
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.ActiveDirectoryFieldObjectType", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("ActiveDirectoryFieldId")
+ .HasColumnType("int");
+
+ b.Property("CustomActiveDirectoryFieldId")
+ .HasColumnType("int");
+
+ b.Property("ObjectType")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomActiveDirectoryFieldId");
+
+ b.ToTable("ActiveDirectoryFieldObjectMappings");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.AppSettings", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("int");
+
+ b.Property("AnalyticsId")
+ .HasColumnType("longtext");
+
+ b.Property("AppFQDN")
+ .HasColumnType("longtext");
+
+ b.Property("AppIcon")
+ .HasColumnType("longblob");
+
+ b.Property("AppName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("AutoUpdate")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("AutoUpdateTime")
+ .HasColumnType("time(6)");
+
+ b.Property("ForceHTTPS")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("InstallationCompleted")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("LastUpdateCheck")
+ .HasColumnType("datetime(6)");
+
+ b.Property("MOTD")
+ .HasColumnType("longtext");
+
+ b.Property("MyrtilleURL")
+ .HasColumnType("longtext");
+
+ b.Property("SSLCertificateCipher")
+ .HasColumnType("longtext");
+
+ b.Property("SendDeveloperAnalytics")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("SendLogsToDeveloper")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("UpdateBranch")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("UpdateDomain")
+ .HasColumnType("longtext");
+
+ b.Property("UpdatePassword")
+ .HasColumnType("longtext");
+
+ b.Property("UpdateUsername")
+ .HasColumnType("longtext");
+
+ b.Property("UseUpdateCredentials")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("UserHelpdeskURL")
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("AppSettings", t =>
+ {
+ t.HasCheckConstraint("CK_Table_Column", "Id = 1")
+ .HasName("CK_Table_Column1");
+ });
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Audit.DirectoryEntryAuditLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("Action")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("AfterAction")
+ .HasColumnType("longtext");
+
+ b.Property("BeforeAction")
+ .HasColumnType("longtext");
+
+ b.Property("IpAddress")
+ .HasColumnType("longtext");
+
+ b.Property("Sid")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Target")
+ .HasColumnType("longtext");
+
+ b.Property("Timestamp")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("DirectoryEntryAuditLogs");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Audit.LogonAuditLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("Action")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("AfterAction")
+ .HasColumnType("longtext");
+
+ b.Property("BeforeAction")
+ .HasColumnType("longtext");
+
+ b.Property("IpAddress")
+ .HasColumnType("longtext");
+
+ b.Property("Target")
+ .HasColumnType("longtext");
+
+ b.Property("Timestamp")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("LogonAuditLog");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Audit.PermissionsAuditLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("Action")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("AfterAction")
+ .HasColumnType("longtext");
+
+ b.Property("BeforeAction")
+ .HasColumnType("longtext");
+
+ b.Property("IpAddress")
+ .HasColumnType("longtext");
+
+ b.Property("Target")
+ .HasColumnType("longtext");
+
+ b.Property("Timestamp")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("PermissionsAuditLog");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Audit.RequestAuditLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("Action")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("AfterAction")
+ .HasColumnType("longtext");
+
+ b.Property("BeforeAction")
+ .HasColumnType("longtext");
+
+ b.Property("IpAddress")
+ .HasColumnType("longtext");
+
+ b.Property("Target")
+ .HasColumnType("longtext");
+
+ b.Property("Timestamp")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("RequestAuditLog");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Audit.SettingsAuditLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("Action")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("AfterAction")
+ .HasColumnType("longtext");
+
+ b.Property("BeforeAction")
+ .HasColumnType("longtext");
+
+ b.Property("IpAddress")
+ .HasColumnType("longtext");
+
+ b.Property("Target")
+ .HasColumnType("longtext");
+
+ b.Property("Timestamp")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("SettingsAuditLog");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Audit.SystemAuditLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("Action")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("AfterAction")
+ .HasColumnType("longtext");
+
+ b.Property("BeforeAction")
+ .HasColumnType("longtext");
+
+ b.Property("IpAddress")
+ .HasColumnType("longtext");
+
+ b.Property("Target")
+ .HasColumnType("longtext");
+
+ b.Property("Timestamp")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("SystemAuditLog");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.AuthenticationSettings", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("int");
+
+ b.Property("AdminPassword")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("DuoApiHost")
+ .HasColumnType("longtext");
+
+ b.Property("DuoClientId")
+ .HasColumnType("longtext");
+
+ b.Property("DuoClientSecret")
+ .HasColumnType("longtext");
+
+ b.Property("DuoEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("DuoUnreachableBehavior")
+ .HasColumnType("int");
+
+ b.Property("SessionTimeout")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("AuthenticationSettings", t =>
+ {
+ t.HasCheckConstraint("CK_Table_Column", "Id = 1")
+ .HasName("CK_Table_Column2");
+ });
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ AdminPassword = "password",
+ DuoEnabled = false,
+ DuoUnreachableBehavior = 0,
+ SessionTimeout = 15
+ });
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Chat.ChatRoom", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("DeletedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("IsPublic")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("MembersHash")
+ .HasColumnType("bigint");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("ChatRooms");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Chat.UnreadChatMessage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("ChatMessageId")
+ .HasColumnType("int");
+
+ b.Property("ChatRoomId")
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChatMessageId");
+
+ b.ToTable("UnreadChatMessages");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.CustomActiveDirectoryField", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("DeletedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("FieldName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("FieldType")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("CustomActiveDirectoryFields");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.EmailSettings", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("int");
+
+ b.Property("AdminBcc")
+ .HasColumnType("longtext");
+
+ b.Property("Enabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("FromAddress")
+ .HasColumnType("longtext");
+
+ b.Property("FromName")
+ .HasColumnType("longtext");
+
+ b.Property("ReplyToAddress")
+ .HasColumnType("longtext");
+
+ b.Property("ReplyToName")
+ .HasColumnType("longtext");
+
+ b.Property("SMTPPassword")
+ .HasColumnType("longtext");
+
+ b.Property("SMTPPort")
+ .HasColumnType("int");
+
+ b.Property("SMTPServer")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("SMTPUsername")
+ .HasColumnType("longtext");
+
+ b.Property("UseSMTPAuth")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("UseTLS")
+ .HasColumnType("tinyint(1)");
+
+ b.HasKey("Id");
+
+ b.ToTable("EmailSettings", t =>
+ {
+ t.HasCheckConstraint("CK_Table_Column", "Id = 1")
+ .HasName("CK_Table_Column3");
+ });
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.EmailTemplate", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("Body")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Subject")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("TemplateType")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("EmailTemplates");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Notifications.NotificationSubscription", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("Block")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("ByEmail")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("DeletedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("InApp")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("OU")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("NotificationSubscriptions");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Notifications.SubscriptionNotificationType", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("NotificationSubscriptionId")
+ .HasColumnType("int");
+
+ b.Property("NotificationType")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NotificationSubscriptionId");
+
+ b.ToTable("SubscriptionNotificationType");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Permissions.AccessLevel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("DeletedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("AccessLevels");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ Name = "Deny All"
+ });
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Permissions.ActionAccessMapping", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("AccessLevelId")
+ .HasColumnType("int");
+
+ b.Property("AllowOrDeny")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("ObjectActionId")
+ .HasColumnType("int");
+
+ b.Property("ObjectType")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AccessLevelId");
+
+ b.HasIndex("ObjectActionId");
+
+ b.ToTable("ActionAccessMapping");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Permissions.FieldAccessLevel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("Level")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("FieldAccessLevel");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ Level = 10,
+ Name = "Deny"
+ },
+ new
+ {
+ Id = 2,
+ Level = 100,
+ Name = "Read"
+ },
+ new
+ {
+ Id = 3,
+ Level = 1000,
+ Name = "Edit"
+ });
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Permissions.FieldAccessMapping", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("CustomFieldId")
+ .HasColumnType("int");
+
+ b.Property("FieldAccessLevelId")
+ .HasColumnType("int");
+
+ b.Property("FieldId")
+ .HasColumnType("int");
+
+ b.Property("ObjectType")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomFieldId");
+
+ b.HasIndex("FieldAccessLevelId");
+
+ b.HasIndex("FieldId");
+
+ b.ToTable("AccessLevelFieldMapping");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Permissions.ObjectAccessLevel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("Level")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("ObjectAccessLevel");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ Level = 10,
+ Name = "Deny"
+ },
+ new
+ {
+ Id = 2,
+ Level = 1000,
+ Name = "Read"
+ });
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Permissions.ObjectAccessMapping", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("AllowDisabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("DeletedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("ObjectAccessLevelId")
+ .HasColumnType("int");
+
+ b.Property("ObjectType")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ObjectAccessLevelId");
+
+ b.ToTable("AccessLevelObjectMapping");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Permissions.ObjectAction", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("Action")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("ObjectActionFlag");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ Action = 4,
+ Name = "Assign"
+ },
+ new
+ {
+ Id = 2,
+ Action = 3,
+ Name = "UnAssign"
+ },
+ new
+ {
+ Id = 3,
+ Action = 8,
+ Name = "Unlock"
+ },
+ new
+ {
+ Id = 4,
+ Action = 5,
+ Name = "Enable"
+ },
+ new
+ {
+ Id = 5,
+ Action = 6,
+ Name = "Disable"
+ },
+ new
+ {
+ Id = 6,
+ Action = 7,
+ Name = "Rename"
+ },
+ new
+ {
+ Id = 7,
+ Action = 0,
+ Name = "Move"
+ },
+ new
+ {
+ Id = 8,
+ Action = 2,
+ Name = "Create"
+ },
+ new
+ {
+ Id = 9,
+ Action = 1,
+ Name = "Delete"
+ },
+ new
+ {
+ Id = 10,
+ Action = 9,
+ Name = "Set Password"
+ });
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Permissions.PermissionDelegate", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("DelegateName")
+ .HasColumnType("longtext");
+
+ b.Property("DelegateSid")
+ .IsRequired()
+ .HasColumnType("varbinary(3072)");
+
+ b.Property("DeletedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("IsSuperAdmin")
+ .HasColumnType("tinyint(1)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DelegateSid")
+ .IsUnique();
+
+ b.ToTable("PermissionDelegate");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Permissions.PermissionMapping", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("DeletedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("OU")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("PermissionMap");
+ });
+
+ modelBuilder.Entity("BLAZAM.Database.Models.Templates.DirectoryTemplate", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property