コード例 #1
0
        public void TestOfAdminCreatePermission()
        {
            InitAdmins();

            var mainApp = this.CreateDefaultApp();

            var testPermission = base.NewObject <SCPermission>("测试权限");

            FacadeWithAcl.AddPermission(testPermission, mainApp);

            Assert.IsNotNull((PC.SCPermission)PC.Adapters.SchemaObjectAdapter.Instance.Load(testPermission.ID), "未创建权限");
        }
コード例 #2
0
        public void TestOfIllegalCreatePermission()
        {
            this.InitAdmins();

            var mainApp  = this.CreateDefaultApp();
            var mainRole = this.CreateDefaultRoleWithMembers(this.GetSCUsersByCodeNames("wanglch"));

            base.SetContainerMemberAndPermissions(mainApp, mainRole, new string[] { "AddPermissions" });

            this.SetCurrentPrincipal(this.GetUserByCodeName("chenke"));

            var testPermission = NewObject <SCPermission>("测试权限");

            FacadeWithAcl.AddPermission(testPermission, mainApp);
            Assert.Fail("不应该执行到此");
        }
コード例 #3
0
        public void TestOfCreatePermission()
        {
            this.InitAdmins();

            var mainApp  = this.CreateDefaultApp();
            var mainRole = this.CreateDefaultRoleWithMembers(this.GetSCUsersByCodeNames("wanglch"));

            base.SetContainerMemberAndPermissions(mainApp, mainRole, new string[] { "AddPermissions" });

            this.SetCurrentPrincipal(this.GetUserByCodeName("wanglch"));

            var testPermission = NewObject <SCPermission>("测试权限");

            FacadeWithAcl.AddPermission(testPermission, mainApp);

            //应该创建成功

            Assert.IsNotNull((PC.SCPermission)PC.Adapters.SchemaObjectAdapter.Instance.Load(testPermission.ID), "未创建权限");
        }