Skip to content

Commit 30e6455

Browse files
committed
update demo
1 parent 790e1fa commit 30e6455

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

samples/Sample.Application/Sample.Application.Client/Pages/PrivilegeDemo.razor

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ else
7777
</div>
7878
<div class="col-md-4">
7979
<label class="form-label">Password</label>
80-
<PrivilegeInputPassword class="form-control" @bind-Value="Model.Password" Subject="Product" Field="Password" Togglable="false" ToggleClass="text-body-tertiary" />
80+
<PrivilegeInputPassword class="form-control" @bind-Value="Model.Password" Subject="Product" Field="Password" Togglable="true" ToggleClass="text-body-tertiary" />
81+
</div>
82+
<div class="col-md-6">
83+
<label class="form-label">Release Date</label>
84+
<PrivilegeInputDate class="form-control" @bind-Value="Model.ReleaseDate" Subject="Product" Field="ReleaseDate" />
8185
</div>
8286

8387
</div>
@@ -95,7 +99,7 @@ else
9599
</tr>
96100
</thead>
97101
<tbody>
98-
@foreach (var field in new[] { "Title", "Summary", "Cost", "InternalNotes", "Password" })
102+
@foreach (var field in new[] { "Title", "Summary", "Cost", "InternalNotes", "Password", "ReleaseDate" })
99103
{
100104
<tr>
101105
<td>@field</td>
@@ -128,5 +132,7 @@ else
128132
public string InternalNotes { get; set; } = "Secret stuff";
129133

130134
public string Password { get; set; } = "P@ssw0rd!";
135+
136+
public DateOnly ReleaseDate { get; set; }
131137
}
132138
}

samples/Sample.Application/Sample.Application.Client/Services/PrivilegeContextProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public ValueTask<PrivilegeContext> GetContextAsync(ClaimsPrincipal? claimsPrinci
2323

2424
// Global allowances
2525
.Allow("read", PrivilegeRule.Any) // read everything
26-
.Allow("update", "Product", ["Title", "Summary", "Password"]) // update selected product fields
26+
.Allow("update", "Product", ["Title", "Summary", "Password", "ReleaseDate"]) // update selected product fields
2727
.Allow("create", "Product")
2828
.Allow("read", "Order")
2929

0 commit comments

Comments
 (0)