Example #1
0
 internal static StatePath Create(string path, PermissionModifier permission, Func <object> valueGetter, Action <object> valueSetter)
 {
     return(new StatePath
     {
         Path = path,
         Permission = permission,
         _valueGetter = valueGetter,
         _valueSetter = valueSetter,
     });
 }
Example #2
0
        public PermissionExpression(string node)
        {
            if (node[0] == '-')
            {
                _modifier = PermissionModifier.Deny;
                node      = node.Substring(1);
            }
            else
            {
                _modifier = PermissionModifier.Allow;
            }

            // TODO throw exception if invalid * or - characters are in the node
            _node = node.Split('.');
        }
 // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local
 private void Test(string expression, string node, PermissionModifier expected)
 {
     Assert.Equal(expected, new PermissionExpression(expression).Evaluate(node.Split('.')));
 }
 public void MiddleWildcard(string expression, string node, PermissionModifier expected)
 {
     Test(expression, node, expected);
 }
 public void ExactMatch(string expression, string node, PermissionModifier expected)
 {
     Test(expression, node, expected);
 }