コード例 #1
0
ファイル: ModelTest.cs プロジェクト: waodng/Casbin.NET
        public void TestRbacModelWithResourceRoles()
        {
            var e = new Enforcer(_testModelFixture.GetNewRbacWithResourceRoleTestModel());

            e.BuildRoleLinks();

            TestEnforce(e, "alice", "data1", "read", true);
            TestEnforce(e, "alice", "data1", "write", true);
            TestEnforce(e, "alice", "data2", "read", false);
            TestEnforce(e, "alice", "data2", "write", true);
            TestEnforce(e, "bob", "data1", "read", false);
            TestEnforce(e, "bob", "data1", "write", false);
            TestEnforce(e, "bob", "data2", "read", false);
            TestEnforce(e, "bob", "data2", "write", true);
        }