現在、私のコントローラーは次のようになっています。
public class ProductBrandsController : Controller
[Authorize]
各アクションだけでなく、コントローラー自体にもデコレーターを適用できることをオンラインで読みました。
カスタムデコレータを宣言する方法はありますか?私はそれを次のように呼びます:
[Authorize(Roles = "God")]
public class ProductBrandsController : Controller
あるいは、それは面倒すぎるかもしれません。新しいデコレータを作成して、次のように呼び出してもかまいません。
[Administrator]
public class ProductBrandsController : Controller
//Or
[ContentManager]
public class ProductBrandsController : Controller
次に、ログインしているユーザーがロールに含まれているかどうかを確認するカスタム クラスを作成します。
これにアプローチする方法について何か提案はありますか?