DEV Community

Benjamin Fadina
Benjamin Fadina

Posted on

Developing Hotel Management App With Radzen Blazor WebAssembly (Lesson 9) Custom Security Part 5

In this lesson, I replace the textbox control for password on the login page with a password control. I then proceed to create custom tables to store roles and users in roles. Appropriate relationships between appusers,approles and usersinroles tables are created. I proceed to update the application model to generate C# POCO model classes for these tables.
I customize the AppUser model generated by RADZEN by adding a new partial class definition for the AppUser class which contains a property called RoleNames so that when a user is authenticated, the list of roles associated with the user is fetched as well. RoleNames property is decorated with NotMapped attribute. I scaffold BLAZOR pages for the two new tables using RADZEN. Lastly, I update LoginUser method inside MyAppUser controller so that when a user is authenticated, the list of roles associated with the user is fetched as well.

Discussion (0)