Repository metrics
- Stars
- (2 stars)
- PR merge metrics
- (PR metrics pending)
Description
Implement a robust and maintainable authorization mechanism to ensure that users can only delete their own content, while administrators have extended permissions, such as the ability to delete any story or comment. The solution should be designed for reusability across different parts of the application, particularly for handling role-based access control involving administrators and other roles.
Avoid using the built-in Microsoft IdentityUser as it is unnecessarily large for our requirements. Instead, utilize the Role property in the existing UserAccount class. Introduce a middleware-based approach to enforce role-based access at a global level, combined with MediatR pipeline behaviors to handle role restrictions for specific commands and queries. This design provides flexibility, simplicity, and scalability.