mo-esmp / DynamicRoleBasedAuthorizationNETCore

Dynamic Role-Based Access Control for ASP.NET Core MVC and Web API
GNU General Public License v3.0
451 stars 94 forks source link

Menu Lists Based on Role/Claim #19

Closed weedkiller closed 3 years ago

weedkiller commented 3 years ago

Hi, couple of ideas:

See Menu/View in admin page: it would be nice to have a view of which menus are visible to which roles and which claims. Also the samples from manual are not working with this master release.

mo-esmp commented 3 years ago

Well, this library has no idea how the menu is going to be rendered but you can wrap the menu codes inside secure-content tag helper to check whether the user has access to the content or not.

https://github.com/mo-esmp/DynamicRoleBasedAuthorizationNETCore/blob/8f49b237b9f69ef3abc6f6ae6ce51f7f80d02c64/samples/netcore3.x/SampleMvcWebAppWithUi/Views/Shared/_Layout.cshtml#L30

The manual branch is a step-by-step walkthrough to implement dynamic authorization on your own and of course, it's outdated however the idea of how to implement dynamic auth is the same on both master and manual branches.