Skip to content

To Do List

meliora-solution edited this page Jan 31, 2024 · 6 revisions

February 2024

Edit UserManagement project

  • Edit InviteUser.razor so user can be given roles from multiple selection available.
  • Create,Update Roles

Issue with user.HasPermission with EasyStock.

user.HasPermission(UserPermissions.PermissonName) is not a problem in UserManagement project but is not working for EasyStock which use http to connect to web api project to to get the data.

Another approach to solve is below. It is working but it is a little bit slow.

// Fetch permissions during initialization or when needed
var result = await httpClient.GetAsync("api/Authenticate/getuserpermissions");

if (result.IsSuccessStatusCode)
{
    var contentTemp = await result.Content.ReadAsStringAsync();
    roles = JsonConvert.DeserializeObject<List<string>>(contentTemp);
}

// Use roles in your conditional checks - NavMenu 
@if (roles != null && roles.Contains("AccessPageLevelOne"))
{
    <FluentNavLink Href="contactList" Icon="@(new Icons.Regular.Size20.WeatherPartlyCloudyDay())" IconColor="Color.Accent">Contact List</FluentNavLink>
    <FluentNavLink Href="contactCreate" Icon="@(new Icons.Regular.Size20.WeatherPartlyCloudyDay())" IconColor="Color.Accent">EasyStock Contact</FluentNavLink>
}

Clone this wiki locally