Beispiel #1
0
        public void TestAbacWithEvalModel()
        {
            var e        = new Enforcer(_testModelFixture.GetNewAbacWithEvalModel());
            var subject1 = new TestSubject("alice", 16);
            var subject2 = new TestSubject("alice", 20);
            var subject3 = new TestSubject("alice", 65);

            TestEnforce(e, subject1, "/data1", "read", false);
            TestEnforce(e, subject1, "/data2", "read", false);
            TestEnforce(e, subject1, "/data1", "write", false);
            TestEnforce(e, subject1, "/data2", "write", true);

            TestEnforce(e, subject2, "/data1", "read", true);
            TestEnforce(e, subject2, "/data2", "read", false);
            TestEnforce(e, subject2, "/data1", "write", false);
            TestEnforce(e, subject2, "/data2", "write", true);

            TestEnforce(e, subject3, "/data1", "read", true);
            TestEnforce(e, subject3, "/data2", "read", false);
            TestEnforce(e, subject3, "/data1", "write", false);
            TestEnforce(e, subject3, "/data2", "write", false);
        }