DamianEdwards / TagHelperPack

A set of useful, and possibly opinionated, Tag Helpers for ASP.NET Core
MIT License
339 stars 58 forks source link

AuthZ: Not Authorized By Policy #54

Open dahlbyk opened 1 year ago

dahlbyk commented 1 year ago

I recently encountered a situation where I wanted to show something if the user doesn't satisfy a policy, e.g.

<button class="btn" asp-authz-policy="AdminPolicy>Delete</button>
<span class="btn btn-disabled" asp-authz-not-policy="AdminPolicy">Delete</span>

Does asp-authz-not-policy seem reasonable to implement?

DamianEdwards commented 1 year ago

Sure, it would just be checking if the user doesn't pass a given authz policy.