예제 #1
0
        public void LegalDeleteOrganizationTest()
        {
            InitAdmins();

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

            var mainOrg = base.GetOrganizationByCodeName("costEngineer");

            var orgParent = this.NewObject <PC.SCOrganization>("父组织");

            Facade.AddOrganization(orgParent, mainOrg);

            this.SetContainerMemberAndPermissions(mainOrg, mainRole, new string[] { "DeleteChildren" });

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

            var testOrg = this.NewObject <PC.SCOrganization>("测试组织");

            Facade.AddOrganization(testOrg, orgParent);

            FacadeWithAcl.DeleteOrganization(testOrg, orgParent, false);

            var actual = PC.Adapters.SchemaRelationObjectAdapter.Instance.Load(orgParent.ID, testOrg.ID);

            Assert.IsNotNull(actual);

            Assert.AreNotEqual(actual.Status, SchemaObjectStatus.Normal);
        }
예제 #2
0
        public void AdminDeleteOrganizationTest()
        {
            InitAdmins();

            var mainOrg = base.GetOrganizationByCodeName("costEngineer");

            var orgParent = this.NewObject <PC.SCOrganization>("父组织");

            Facade.AddOrganization(orgParent, mainOrg);

            var testOrg = this.NewObject <PC.SCOrganization>("测试组织");

            Facade.AddOrganization(testOrg, orgParent);

            FacadeWithAcl.DeleteOrganization(testOrg, orgParent, false);

            var actual = PC.Adapters.SchemaRelationObjectAdapter.Instance.Load(orgParent.ID, testOrg.ID);

            Assert.IsNotNull(actual);

            Assert.AreNotEqual(actual.Status, SchemaObjectStatus.Normal);
        }
예제 #3
0
        public void IllegalDeleteOrganizationTest()
        {
            InitAdmins();

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

            var mainOrg = base.GetOrganizationByCodeName("costEngineer");

            var orgParent = this.NewObject <PC.SCOrganization>("父组织");

            Facade.AddOrganization(orgParent, mainOrg);

            this.SetContainerMemberAndPermissions(mainOrg, mainRole, new string[] { "DeleteChildren" });

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

            var testOrg = this.NewObject <PC.SCOrganization>("测试组织");

            Facade.AddOrganization(testOrg, orgParent);

            FacadeWithAcl.DeleteOrganization(testOrg, orgParent, false);

            Assert.Fail("不应执到此");
        }