ファイルの内容を変更するコントローラーで定義されたいくつかのアクションがあります(もちろん、コントローラーから直接変更することはありませんが、このコントローラーはモデルからメソッドを呼び出します)。その機能の上に、管理者権限が必要であると言及するカスタム属性を配置しました。
アクションは次のようになります。
[CustomAttribute(MustBeAdmin = true)]
public ActionResult ModifyFile(){
  ...
}
次のようになりCustomAttributeます。
public class CustomAuttribute: AuthorizeAttribute 
{
   public bool MustBeAdmin {get;set;}
   protected override void HandleUnauthorizedRequest( AuthorizationContext filterContext) {
       if ( filterContext.RequestContext.HttpContext.Session["user"] == null ) { ... }
       else { ... // check if is need admin rights and current has this right then continue else go to default route }
   }
}
セキュリティ上の理由から、誰かがMustBeAdminコードの外部からパラメーターを false 値に設定できるかどうかを尋ねたいですか?
はいの場合、これを防ぐ方法は?
ありがとう