コード例 #1
0
ファイル: SkipAuthorizeRule.cs プロジェクト: phanhuy/FxCop
 public override ProblemCollection Check(TypeNode type)
 {
     if (type.IsController() && type.Attributes.Any(a => a.Type.FullName == "CDS.Web.Authorization.SkipAuthorizeAttribute"))
     {
         Problems.Add(new Problem(this.GetResolution()));
     }
     return Problems;
 }
コード例 #2
0
 public override ProblemCollection Check(TypeNode type)
 {
     if (type.IsController() && type.Attributes.Any(a => a.Type.FullName == "CDS.Web.Authorization.SkipAuthorizeAttribute"))
     {
         Problems.Add(new Problem(this.GetResolution()));
     }
     return(Problems);
 }
コード例 #3
0
ファイル: MissingRoleCheckRule.cs プロジェクト: phanhuy/FxCop
        public override ProblemCollection Check(TypeNode type)
        {
            if (type.IsController()) //only applies to controllers
            {
                while (type != null)
                {
                    //MOD: we use a custom attribute here (mostly just to display a friendly error). You may also do something like that.
                    if (type.Attributes.Any(a => a.Type.FullName == "System.Web.Mvc.AuthorizeAttribute"))
                    {
                        return Problems; //it's got a capability check, no worries bra
                    }
                    type = type.BaseType;
                }

                Problems.Add(new Problem(this.GetResolution()));
            }
            return Problems;
        }
コード例 #4
0
        public override ProblemCollection Check(TypeNode type)
        {
            if (type.IsController()) //only applies to controllers
            {
                while (type != null)
                {
                    //MOD: we use a custom attribute here (mostly just to display a friendly error). You may also do something like that.
                    if (type.Attributes.Any(a => a.Type.FullName == "System.Web.Mvc.AuthorizeAttribute"))
                    {
                        return(Problems); //it's got a capability check, no worries bra
                    }
                    type = type.BaseType;
                }

                Problems.Add(new Problem(this.GetResolution()));
            }
            return(Problems);
        }