Skip to content

Commit 06bcd00

Browse files
author
Casparus J Van Zyl
committed
Update Role Permissions.
Update User Roles
1 parent 61f1b54 commit 06bcd00

File tree

11 files changed

+925
-609
lines changed

11 files changed

+925
-609
lines changed

src/apps/blazor/client/Pages/Identity/Roles/RolePermissions.razor

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@page "/identity/roles/{Id}/permissions"
22
@inject Microsoft.Extensions.Localization.IStringLocalizer<RolePermissions> _localizer
3+
34
<PageHeader Title="@_title" Header="@_title" SubHeader="@_description" />
45

56
@if (!_loaded)
@@ -19,46 +20,44 @@ else
1920
<ToolBarContent>
2021
<div class="justify-center mud-text-align-center">
2122
<MudButton Variant="Variant.Filled" DropShadow="false" Color="Color.Info" Class="ml-auto" StartIcon="@Icons.Material.Filled.ArrowBack" Href="/identity/roles">
22-
Back
23+
@_localizer["Back"]
2324
</MudButton>
2425
@if (_canEditRoleClaims)
2526
{
2627
<MudButton Variant="Variant.Filled" DropShadow="false" Color="Color.Primary" Class="ml-auto" OnClick="SaveAsync"
27-
ButtonType="ButtonType.Submit" Style="margin-left: 5px!important;" StartIcon="@Icons.Material.Filled.Save">Update Permissions
28+
ButtonType="ButtonType.Submit" Style="margin-left: 5px!important;" StartIcon="@Icons.Material.Filled.Save">
29+
@_localizer["Update Permissions"]
2830
</MudButton>
2931
}
3032
</div>
3133
<MudSpacer />
3234
@if (_canSearchRoleClaims)
3335
{
3436
<MudTextField @bind-Value="_searchString" Immediate="true" FullWidth=false
35-
Placeholder="Search For Role Permissions" Adornment="Adornment.End"
37+
Placeholder="@_localizer["Search For Role Permissions"]" Adornment="Adornment.End"
3638
AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0 mb-3">
3739
</MudTextField>
3840
}
3941
</ToolBarContent>
4042
<HeaderContent>
4143
<MudTh>
42-
<MudTableSortLabel SortBy="new Func<PermissionViewModel, object?>(x => x.Name)">
43-
Permission Name</MudTableSortLabel>
44+
<MudTableSortLabel SortBy="new Func<PermissionViewModel, object?>(x => x.Name)">@_localizer["Permission Name"]</MudTableSortLabel>
4445
</MudTh>
4546
<MudTh>
46-
<MudTableSortLabel SortBy="new Func<PermissionViewModel, object?>(x => x.Description)">
47-
Description</MudTableSortLabel>
47+
<MudTableSortLabel SortBy="new Func<PermissionViewModel, object?>(x => x.Description)">@_localizer["Description"]</MudTableSortLabel>
4848
</MudTh>
4949
<MudTh>
50-
<MudTableSortLabel SortBy="new Func<PermissionViewModel, object>(x => x.Enabled)">Status
51-
</MudTableSortLabel>
50+
<MudTableSortLabel SortBy="new Func<PermissionViewModel, object>(x => x.Enabled)">@_localizer["Status"]</MudTableSortLabel>
5251
</MudTh>
5352
</HeaderContent>
5453
<RowTemplate>
55-
<MudTd DataLabel="Permission Name">
54+
<MudTd DataLabel="@_localizer["Permission Name"]">
5655
<MudHighlighter Text="@context.Name" HighlightedText="@_searchString" />
5756
</MudTd>
58-
<MudTd DataLabel="Description">
57+
<MudTd DataLabel="@_localizer["Description"]">
5958
<MudHighlighter Text="@context.Description" HighlightedText="@_searchString" />
6059
</MudTd>
61-
<MudTd DataLabel="Permission">
60+
<MudTd DataLabel="@_localizer["Permission"]">
6261
<MudCheckBox T="bool" @bind-Value="@context.Enabled" Disabled="@(!_canEditRoleClaims)" Color="Color.Secondary">
6362
</MudCheckBox>
6463
</MudTd>

src/apps/blazor/client/Pages/Identity/Roles/RolePermissions.razor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ protected override async Task OnInitializedAsync()
4545
() => RolesClient.GetRolePermissionsEndpointAsync(Id), Toast, Navigation)
4646
is RoleDto role && role.Permissions is not null)
4747
{
48-
_title = string.Format("{0} Permissions", role.Name);
49-
_description = string.Format("Manage {0} Role Permissions", role.Name);
48+
_title = $"{role.Name} {_localizer["Permissions"]}";
49+
_description = $"{_localizer["Manage"]} {role.Name} {_localizer["Role Permissions"]}";
5050

5151
var permissions = state.User.GetTenant() == TenantConstants.Root.Id
5252
? FshPermissions.All
@@ -88,7 +88,7 @@ private async Task SaveAsync()
8888
await ApiHelper.ExecuteCallGuardedAsync(
8989
() => RolesClient.UpdateRolePermissionsEndpointAsync(request.RoleId, request),
9090
Toast,
91-
successMessage: "Updated Permissions.");
91+
successMessage: _localizer["Updated Permissions."]);
9292
Navigation.NavigateTo("/identity/roles");
9393
}
9494

src/apps/blazor/client/Pages/Identity/Users/UserRoles.razor

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,44 +13,44 @@ else
1313
<ToolBarContent>
1414
<div class="justify-center mud-text-align-center">
1515
<MudButton Variant="Variant.Filled" DropShadow="false" Color="Color.Info" Class="ml-auto" StartIcon="@Icons.Material.Filled.ArrowBack" Href="/identity/users">
16-
Back
16+
@_localizer["Back"]
1717
</MudButton>
1818
@if (_canEditUsers)
1919
{
2020
<MudButton Variant="Variant.Filled" DropShadow="false" Color="Color.Primary" Class="ml-auto" OnClick="SaveAsync" StartIcon="@Icons.Material.Filled.Save"
2121
ButtonType="ButtonType.Submit" Style="margin-left: 5px!important;">
22-
Update
22+
@_localizer["Update"]
2323
</MudButton>
2424
}
2525
</div>
2626
<MudSpacer />
2727
@if (_canSearchRoles)
2828
{
2929
<MudTextField @bind-Value="_searchString" Immediate="true" FullWidth=false
30-
Placeholder="Search For User Roles" Adornment="Adornment.End"
30+
Placeholder="@_localizer["Search For User Roles"]" Adornment="Adornment.End"
3131
AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0 mb-3">
3232
</MudTextField>
3333
}
3434
</ToolBarContent>
3535
<HeaderContent>
3636
<MudTh>
37-
<MudTableSortLabel SortBy="new Func<UserRoleDetail, object?>(x => x.RoleName)">Role Name</MudTableSortLabel>
37+
<MudTableSortLabel SortBy="new Func<UserRoleDetail, object?>(x => x.RoleName)">@_localizer["Role Name"]</MudTableSortLabel>
3838
</MudTh>
3939
<MudTh>
40-
<MudTableSortLabel SortBy="new Func<UserRoleDetail, object?>(x => x.Description)">Description</MudTableSortLabel>
40+
<MudTableSortLabel SortBy="new Func<UserRoleDetail, object?>(x => x.Description)">@_localizer["Description"]</MudTableSortLabel>
4141
</MudTh>
4242
<MudTh>
43-
<MudTableSortLabel SortBy="new Func<UserRoleDetail, object>(x => x.Enabled)">Status</MudTableSortLabel>
43+
<MudTableSortLabel SortBy="new Func<UserRoleDetail, object>(x => x.Enabled)">@_localizer["Status"]</MudTableSortLabel>
4444
</MudTh>
4545
</HeaderContent>
4646
<RowTemplate>
47-
<MudTd DataLabel="Role Name">
47+
<MudTd DataLabel="@_localizer["Role Name"]">
4848
<MudHighlighter Text="@context.RoleName" HighlightedText="@_searchString" />
4949
</MudTd>
50-
<MudTd DataLabel="Description">
50+
<MudTd DataLabel="@_localizer["Description"]">
5151
<MudHighlighter Text="@context.Description" HighlightedText="@_searchString" />
5252
</MudTd>
53-
<MudTd DataLabel="Status">
53+
<MudTd DataLabel="@_localizer["Status"]">
5454
<MudCheckBox T="bool" @bind-Value="@context.Enabled" Disabled="@(!_canEditUsers)" Color="Color.Secondary">
5555
</MudCheckBox>
5656
</MudTd>

src/apps/blazor/client/Pages/Identity/Users/UserRoles.razor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ protected override async Task OnInitializedAsync()
4141
() => UsersClient.GetUserEndpointAsync(Id!), Toast, Navigation)
4242
is UserDetail user)
4343
{
44-
_title = $"{user.FirstName} {user.LastName}'s Roles";
45-
_description = string.Format("Manage {0} {1}'s Roles", user.FirstName, user.LastName);
44+
_title = $"{user.FirstName} {user.LastName}'s {_localizer["Roles"]}";
45+
_description = $"{_localizer["Manage"]} {user.FirstName} {user.LastName}'s {_localizer["Roles"]}";
4646

4747
if (await ApiHelper.ExecuteCallGuardedAsync(
4848
() => UsersClient.GetUserRolesEndpointAsync(user.Id.ToString()), Toast, Navigation)
@@ -67,7 +67,7 @@ private async Task SaveAsync()
6767
await ApiHelper.ExecuteCallGuardedAsync(
6868
() => UsersClient.AssignRolesToUserEndpointAsync(Id, request),
6969
Toast,
70-
successMessage: "updated user roles");
70+
successMessage: _localizer["updated user roles"]);
7171

7272
Navigation.NavigateTo("/identity/users");
7373
}

src/apps/blazor/client/Resources/Components/Dialogs/Logout.af.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@
117117
<resheader name="writer">
118118
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120+
<data name="Cancel" xml:space="preserve">
121+
<value>Kanseleer</value>
122+
</data>
120123
<data name="Logout Confirmation" xml:space="preserve">
121124
<value>Afmeld bevestiging</value>
122125
</data>

0 commit comments

Comments
 (0)