Esempio n. 1
0
        public void MatchSuccessTest()
        {
            PathMatcher target = new PathMatcher();
            string regex = "/xyz/mn/**/pq/*.exe";
            string path = "/xyz/mn/abc/d/pq/x.exe";
            bool actual = target.Match(regex, path);
            Assert.IsTrue(actual, "全英文字符应该匹配");

            regex = "/xyz/中文/**/我国/abc*我的.exe";
            path = "/xyz/中文/**/我国/abc我们的就是我的.exe";
            actual = target.Match(regex, path);
            Assert.IsTrue(actual, "中英文混合字符应该匹配");
        }
Esempio n. 2
0
 public override bool Contains(PermissionInfo permission)
 {
     if (base.Equals(permission))
         return true;//permission为空权限、引用相等或者name与action完全相同
     FilePermissionInfo fp = permission as FilePermissionInfo;
     if (fp == null)
         return false;
     PathMatcher target = new PathMatcher();
     if (target.Match(this.Name, permission.Name))
     {
         //路径匹配,则检查动作
         if ((this.RealAction == NO_ACTION) || (this.RealAction & fp.RealAction) == fp.RealAction)
             return true;
     }
     return false;
 }