public void TestOfIllegalDeletePermission()
        {
            base.InitAdmins();

            var mainApp = this.CreateDefaultApp();

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

            this.CreatePermission(mainApp, testPermission);

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

            FacadeWithAcl.DeletePermission(testPermission);
            Assert.Fail("不应该执行到此");
        }
        public void TestOfAdminDeletePermission()
        {
            this.InitAdmins();

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

            this.CreatePermission(mainApp, testPermission);

            FacadeWithAcl.DeletePermission(testPermission);

            var actual = (PC.SCPermission)PC.Adapters.SchemaObjectAdapter.Instance.Load(testPermission.ID);

            Assert.AreNotEqual(actual.Status, SchemaObjectStatus.Normal);
        }
        public void TestOfDeletePermission()
        {
            this.InitAdmins();

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

            this.SetContainerMemberAndPermissions(mainApp, mainRole, new string[] { "DeletePermissions" });

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

            this.CreatePermission(mainApp, testPermission);

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

            FacadeWithAcl.DeletePermission(testPermission);

            var actual = (PC.SCPermission)PC.Adapters.SchemaObjectAdapter.Instance.Load(testPermission.ID);

            Assert.AreNotEqual(actual.Status, SchemaObjectStatus.Normal);
        }