diff --git a/4-Nine/Features/Administration/Users/View.razor b/4-Nine/Features/Administration/Users/View.razor index 01ee81b..29f1fce 100644 --- a/4-Nine/Features/Administration/Users/View.razor +++ b/4-Nine/Features/Administration/Users/View.razor @@ -42,8 +42,16 @@ else if (viewedUser == null) else if (!canViewUser) {
-

Access Denied

-

You don't have permission to view this user's account.

+ @if (!string.IsNullOrEmpty(errorMessage)) + { +

Unable to Load User

+

@errorMessage

+ } + else + { +

Access Denied

+

You don't have permission to view this user's account.

+ } Back to User Management
} @@ -327,9 +335,15 @@ else // Check permissions var currentOrgId = await UserContext.GetActiveOrganizationIdAsync(); - var currentUserRole = await OrganizationService.GetUserRoleForOrganizationAsync(currentUser.Id, currentOrgId.Value); - isCurrentUserAdmin = currentUserRole == ApplicationConstants.OrganizationRoles.Owner || - currentUserRole == ApplicationConstants.OrganizationRoles.Administrator; + if (!currentOrgId.HasValue) + { + errorMessage = "Unable to determine current organization context."; + return; + } + + var actingUserRole = await OrganizationService.GetUserRoleForOrganizationAsync(currentUser.Id, currentOrgId.Value); + isCurrentUserAdmin = actingUserRole == ApplicationConstants.OrganizationRoles.Owner || + actingUserRole == ApplicationConstants.OrganizationRoles.Administrator; isViewingOwnAccount = currentUser.Id == viewedUser.Id; // Users can view their own account, admins can view any account in the same org @@ -342,8 +356,8 @@ else // Load user's organization role var viewedUserRole = await OrganizationService.GetUserRoleForOrganizationAsync(viewedUser.Id, currentOrgId.Value); userRoles = viewedUserRole != null ? new List { viewedUserRole } : new List(); - currentUserRole = viewedUserRole ?? "No Role"; - selectedRole = currentUserRole; + currentUserRole = viewedUserRole ?? "No role found"; + selectedRole = viewedUserRole ?? string.Empty; isLockedOut = await UserManager.IsLockedOutAsync(viewedUser); // Load available roles for admins diff --git a/4-Nine/Nine.csproj b/4-Nine/Nine.csproj index 462930f..6ad3b38 100644 --- a/4-Nine/Nine.csproj +++ b/4-Nine/Nine.csproj @@ -74,6 +74,7 @@ + @@ -103,7 +104,9 @@ Linux/macOS: npm's allow-scripts policy and extract-zip failures prevent automatic download, so the cache (~/.cache/electron) is used directly via unzip. - Windows: PowerShell Expand-Archive extracts from %LOCALAPPDATA%\electron\Cache. + Windows: the zip is located with an item glob in %LOCALAPPDATA%\electron\Cache and extracted + with MSBuild's Unzip task. PowerShell is avoided because a Windows PowerShell 5.1 child + process can inherit a PowerShell 7 PSModulePath and fail in Expand-Archive. First-time setup (no cache): the build emits a warning with exact steps to seed the cache. --> @@ -136,13 +139,16 @@ - - - - + + + <_ElectronZipCandidate Include="$(_ElectronCacheDir)\**\$(_ElectronZipName)" /> + + + + + <_ElectronZipPath>@(_ElectronZipCandidate) + <_ElectronZipPath Condition="$(_ElectronZipPath.Contains(';'))">$(_ElectronZipPath.Substring(0, $(_ElectronZipPath.IndexOf(';')))) + - - + +