Security for menu items and delete functions for example

I couldn't find if you can 'lock down' certain functions within a page?

For example, only want menu items to show if a certain permission (only admins can see admin pages for example)

Another example, don't show delete buttons for anyone than admin.


For a page you can set a attribute in the .razor file like:
@attribute [Authorize(Roles = "Admin")]

for a button you can set the Visible or Disabled parameter, depends on what you prefer:
<RadzenButton Disabled="@(!Security.IsInRole("Admin"))" Icon="add_circle_outline" style="margin-bottom: 10px" Text="Add" Click="@Button0Click"> </RadzenButton>

1 Like