RuslanPr0g/Hiscaries

Authorization & Role Checks

オープン

#31 opened on 2024/11/08

 (0 件のコメント) (0 件のリアクション) (1 人の担当者)C# (0 件のフォーク)auto 404
enhancementgood first issue

Repository metrics

Stars
 (2 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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.

コントリビューターガイド