Hi
Is there a better way to add an automated permission than replacing an existing component type?
How else can I automatically check permissions on the base component "TelerikButton" instead of "MyTelerikButton"?
With a large number of thousands of fields, it does not want to fill the Enable/Visible per field.
My question is not only about permissions, but also about the ability to extend TelerikButton with its my additional [Parameter] which is not included in the basic set.
I would be grateful if you could suggest a better solution.
@foreach (var item in ListOfItemNames.Take(200))
{
<div class="row">
<div class="col">
<label for="@item">@item</label>
<MyTelerikButton Id="@item" Form="Device" Icon="SvgIcon.Stop" Title="@item" OnClick="@ButtonAction" ButtonType="ButtonType.Button" />
<MyTelerikTextBox Id="@item" Name="Device" Value="@item"></MyTelerikTextBox>
@* ...<Telerik...> etc *@
</div>
</div>
}
My Component
public class MyTelerikButton: TelerikButton
{
[CascadingParameter (Name = "Privileges")]
public required List<Privilege> Privileges { get; set; } = [];
protected override void OnInitialized()
{
base.OnInitialized();
var buttonName = Form + Id;
Enabled = Privileges.Any(x=>x.Code == buttonName);
}
}