public void IllegalMoveGroupTest3()
        {
            this.InitAdmins();

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

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

            var testOrgA  = this.NewObject <PC.SCOrganization>("测试组织A");
            var testOrgB1 = this.NewObject <PC.SCOrganization>("测试组织B1");
            var testOrgB2 = this.NewObject <PC.SCOrganization>("测试组织B2");
            var testGroup = this.NewObject <PC.SCGroup>("测试群组");

            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB1, testOrgA);
            Facade.AddOrganization(testOrgB2, testOrgA);
            Facade.AddGroup(testGroup, testOrgB1);

            this.SetContainerMemberAndPermissions(testOrgB1, mainRole, new string[] { });
            this.SetContainerMemberAndPermissions(testOrgB2, mainRole, new string[] { });

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

            FacadeWithAcl.MoveObjectToOrganization(testOrgB1, testGroup, testOrgB2);

            Assert.Fail("不应执行到此");
        }
示例#2
0
        public void IllegalRemoveUserFromGroupTest()
        {
            this.InitAdmins();

            var mainApp = this.CreateDefaultApp();

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

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

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

            Facade.AddOrganization(testOrg, mainOrg);

            this.SetContainerMemberAndPermissions(testOrg, mainRole, new string[] { "EditMembersOfGroups" });

            PC.SCGroup testGrp = this.NewObject <PC.SCGroup>("测试群组");

            Facade.AddGroup(testGrp, testOrg);

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

            var testUser = this.GetSCUserByCodeName("jinge");

            FacadeWithAcl.RemoveUserFromGroup(testUser, testGrp);

            Assert.Fail("不应执行到此");
        }
        public void LegalMoveGroupTest()
        {
            this.InitAdmins();

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

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

            var testOrgA  = this.NewObject <PC.SCOrganization>("测试组织A");
            var testOrgB1 = this.NewObject <PC.SCOrganization>("测试组织B1");
            var testOrgB2 = this.NewObject <PC.SCOrganization>("测试组织B2");
            var testGroup = this.NewObject <PC.SCGroup>("测试群组");

            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB1, testOrgA);
            Facade.AddOrganization(testOrgB2, testOrgA);
            Facade.AddGroup(testGroup, testOrgB1);

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

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

            FacadeWithAcl.MoveObjectToOrganization(testOrgB1, testGroup, testOrgB2);

            var actual = PC.Adapters.SchemaRelationObjectAdapter.Instance.Load(testOrgB2.ID, testGroup.ID);

            Assert.IsNotNull(actual);
        }
示例#4
0
        public void LegalRemoveUserFromGroupTest()
        {
            this.InitAdmins();

            var mainApp = this.CreateDefaultApp();

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

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

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

            Facade.AddOrganization(testOrg, mainOrg);

            this.SetContainerMemberAndPermissions(testOrg, mainRole, new string[] { "EditMembersOfGroups" });

            PC.SCGroup testGrp = this.NewObject <PC.SCGroup>("测试群组");

            Facade.AddGroup(testGrp, testOrg);

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

            var testUser = this.GetSCUserByCodeName("jinge");

            Facade.AddUserToGroup(testUser, testGrp);

            FacadeWithAcl.RemoveUserFromGroup(testUser, testGrp);

            var actual = PC.Adapters.SCMemberRelationAdapter.Instance.Load(testGrp.ID, testUser.ID);

            Assert.IsNotNull(actual);

            Assert.AreNotEqual(actual.Status, SchemaObjectStatus.Normal);
        }
示例#5
0
        public void AdminRemoveUserFromGroupTest()
        {
            this.InitAdmins();

            PC.SCGroup testGrp = this.NewObject <PC.SCGroup>("测试群组");

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

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

            Facade.AddOrganization(testOrg, mainOrg);

            Facade.AddGroup(testGrp, testOrg);

            var testUser = this.GetSCUserByCodeName("jinge");

            Facade.AddUserToGroup(testUser, testGrp);

            FacadeWithAcl.RemoveUserFromGroup(testUser, testGrp);

            var actual = PC.Adapters.SCMemberRelationAdapter.Instance.Load(testGrp.ID, testUser.ID);

            Assert.IsNotNull(actual);

            Assert.AreNotEqual(actual.Status, SchemaObjectStatus.Normal);
        }
示例#6
0
        public void LegalDeleteGroupTest()
        {
            this.InitAdmins();

            var mainApp = this.CreateDefaultApp();

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

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

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

            Facade.AddOrganization(testOrg, mainOrg);

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

            PC.SCGroup testGrp = this.NewObject <PC.SCGroup>("测试群组");

            Facade.AddGroup(testGrp, testOrg);

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

            FacadeWithAcl.DeleteGroup(testGrp, testOrg, false);

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

            Assert.AreNotEqual(actual.Status, SchemaObjectStatus.Normal);
        }
示例#7
0
        public void AdminDeleteGroupTest()
        {
            this.InitAdmins();

            PC.SCGroup testGrp = this.NewObject <PC.SCGroup>("测试群组");

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

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

            Facade.AddOrganization(testOrg, mainOrg);

            Facade.AddGroup(testGrp, testOrg);

            FacadeWithAcl.DeleteGroup(testGrp, testOrg, false);

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

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

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

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

            var testOrgA  = this.NewObject <PC.SCOrganization>("测试组织A");
            var testOrgB1 = this.NewObject <PC.SCOrganization>("测试组织B1");
            var testOrgB2 = this.NewObject <PC.SCOrganization>("测试组织B2");
            var testGroup = this.NewObject <PC.SCGroup>("测试群组");

            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB1, testOrgA);
            Facade.AddOrganization(testOrgB2, testOrgA);
            Facade.AddGroup(testGroup, testOrgB1);

            FacadeWithAcl.MoveObjectToOrganization(testOrgB1, testGroup, testOrgB2);

            var actual = PC.Adapters.SchemaRelationObjectAdapter.Instance.Load(testOrgB2.ID, testGroup.ID);

            Assert.IsNotNull(actual);
        }