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

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

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

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

            Facade.AddOrganization(testOrg, mainOrg);

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

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

            var testUser = this.NewObject <PC.SCUser>("测试用户");

            Facade.AddUser(testUser, null);

            FacadeWithAcl.AddUserToOrganization(testUser, testOrg);

            Assert.Fail("不应执行到此");
        }
예제 #2
0
        public void LegalAddUserToOrganizationTest()
        {
            InitAdmins();

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

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

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

            Facade.AddOrganization(testOrg, mainOrg);

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

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

            var testUser = this.NewObject <PC.SCUser>("测试用户");

            Facade.AddUser(testUser, null);

            FacadeWithAcl.AddUserToOrganization(testUser, testOrg);

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

            Assert.IsNotNull(actual);
        }
        public void IllegalMoveOrganizationTest1()
        {
            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 testOrgC  = this.NewObject <PC.SCOrganization>("测试组织C");

            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB1, testOrgA);
            Facade.AddOrganization(testOrgB2, testOrgA);
            Facade.AddOrganization(testOrgC, testOrgB1);

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

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

            FacadeWithAcl.MoveObjectToOrganization(testOrgB1, testOrgC, testOrgB2);

            Assert.Fail("不应执行到此");
        }
예제 #4
0
        public void IllegalRemoveUserFromOrgTest()
        {
            InitAdmins();

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

            var mainApp = this.CreateDefaultApp();

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

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

            Facade.AddOrganization(testOrg, mainOrg);

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

            var testUser = NewObject <PC.SCUser>("测试用户");

            Facade.AddUser(testUser, testOrg);

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

            base.RecalculateRoleUsers();

            FacadeWithAcl.DeleteUser(testUser, testOrg, true);

            var relation = PC.Adapters.SchemaRelationObjectAdapter.Instance.Load(testOrg.ID, testUser.ID);

            Assert.Fail("不应执行到此");
        }
예제 #5
0
        public void AdminSetDefaultOrganizationTest()
        {
            InitAdmins();

            var mainRole  = this.CreateDefaultRoleWithMembers(this.GetSCUsersByCodeNames("wanglch"));
            var mainOrg   = this.GetOrganizationByCodeName("costEngineer");
            var testOrgA  = NewObject <PC.SCOrganization>("测试组织A");
            var testOrgB  = NewObject <PC.SCOrganization>("测试组织B");
            var testUserA = this.NewObject <PC.SCUser>("测试用户A");


            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB, mainOrg);
            Facade.AddUser(testUserA, testOrgA);
            Facade.AddUserToOrganization(testUserA, testOrgB);

            FacadeWithAcl.SetUserDefaultOrganization(testUserA, testOrgB);

            var actual = PC.Adapters.SchemaRelationObjectAdapter.Instance.Load(testOrgB.ID, testUserA.ID);

            Assert.IsNotNull(actual);

            Assert.AreEqual(actual.Status, SchemaObjectStatus.Normal);

            Assert.AreEqual(actual.Default, true);
        }
예제 #6
0
        public void IllegalRemoveSecretaryTest3()
        {
            InitAdmins();

            var mainRole  = this.CreateDefaultRoleWithMembers(this.GetSCUsersByCodeNames("wanglch"));
            var mainOrg   = this.GetOrganizationByCodeName("costEngineer");
            var testOrgA  = NewObject <PC.SCOrganization>("测试组织A");
            var testOrgB  = NewObject <PC.SCOrganization>("测试组织B");
            var testUserA = this.NewObject <PC.SCUser>("测试用户A");
            var testUserB = this.NewObject <PC.SCUser>("测试用户B");

            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB, mainOrg);
            Facade.AddUser(testUserA, testOrgA);
            Facade.AddUser(testUserB, testOrgB);

            SetContainerMemberAndPermissions(testOrgB, mainRole, new string[] { "UpdateChildren" });

            Facade.AddSecretaryToUser(testUserA, testUserB);

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

            FacadeWithAcl.RemoveSecretaryFromUser(testUserA, testUserB);

            Assert.Fail("不应执行到此");
        }
        public void LegalMoveOrganizationTest()
        {
            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 testOrgC  = this.NewObject <PC.SCOrganization>("测试组织C");

            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB1, testOrgA);
            Facade.AddOrganization(testOrgB2, testOrgA);
            Facade.AddOrganization(testOrgC, testOrgB1);

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

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

            FacadeWithAcl.MoveObjectToOrganization(testOrgB1, testOrgC, testOrgB2);

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

            Assert.IsNotNull(actual);
        }
예제 #8
0
        public void LegalAddOrganizationTest()
        {
            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(orgParent, mainRole, new string[] { "AddChildren" });

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

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

            FacadeWithAcl.AddOrganization(testOrg, orgParent);

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

            Assert.IsNotNull(actual);

            Assert.AreEqual(actual.Status, SchemaObjectStatus.Normal);
        }
예제 #9
0
        public void LegalAddGroupTest()
        {
            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[] { "AddChildren" });

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

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

            FacadeWithAcl.AddGroup(testGrp, testOrg);

            var actual = this.GetGroupByCodeName(testGrp.CodeName);

            Assert.IsNotNull(actual);
        }
예제 #10
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);
        }
예제 #11
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("不应执行到此");
        }
예제 #12
0
        public void LegalRemoveSecretaryTest()
        {
            InitAdmins();

            var mainRole  = this.CreateDefaultRoleWithMembers(this.GetSCUsersByCodeNames("wanglch"));
            var mainOrg   = this.GetOrganizationByCodeName("costEngineer");
            var testOrgA  = NewObject <PC.SCOrganization>("测试组织A");
            var testOrgB  = NewObject <PC.SCOrganization>("测试组织B");
            var testUserA = this.NewObject <PC.SCUser>("测试用户A");
            var testUserB = this.NewObject <PC.SCUser>("测试用户B");

            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB, mainOrg);
            Facade.AddUser(testUserA, testOrgA);
            Facade.AddUser(testUserB, testOrgB);

            SetContainerMemberAndPermissions(testOrgA, mainRole, new string[] { "UpdateChildren" });
            SetContainerMemberAndPermissions(testOrgB, mainRole, new string[] { "UpdateChildren" });

            Facade.AddSecretaryToUser(testUserA, testUserB);

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

            FacadeWithAcl.RemoveSecretaryFromUser(testUserA, testUserB);

            var actual = PC.Adapters.SCMemberRelationAdapter.Instance.Load(testUserB.ID, testUserA.ID);

            Assert.IsNotNull(actual);

            Assert.AreNotEqual(actual.Status, SchemaObjectStatus.Normal);
        }
예제 #13
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);
        }
예제 #14
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);
        }
        public void AdminMoveUserTest()
        {
            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 testUser  = this.NewObject <PC.SCUser>("测试群组");

            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB1, testOrgA);
            Facade.AddOrganization(testOrgB2, testOrgA);
            Facade.AddUser(testUser, testOrgB1);

            FacadeWithAcl.MoveObjectToOrganization(testOrgB1, testUser, testOrgB2);

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

            Assert.IsNotNull(actual);

            Assert.AreEqual(actual.Default, true);
        }
예제 #16
0
        public void LegalDestroyUserTest()
        {
            this.InitAdmins();

            var mainRole  = this.CreateDefaultRoleWithMembers(this.GetSCUsersByCodeNames("wanglch"));
            var mainOrg   = this.GetOrganizationByCodeName("costEngineer");
            var testOrgA  = NewObject <PC.SCOrganization>("测试组织A");
            var testOrgB  = NewObject <PC.SCOrganization>("测试组织B");
            var testUserA = this.NewObject <PC.SCUser>("测试用户A");

            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB, mainOrg);
            Facade.AddUser(testUserA, testOrgA);
            Facade.AddUserToOrganization(testUserA, testOrgB);

            SetContainerMemberAndPermissions(testOrgA, mainRole, new string[] { "DeleteChildren" });

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

            FacadeWithAcl.DeleteUser(testUserA, null, false);

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

            Assert.IsNotNull(actual);
            Assert.AreEqual(actual.OwnerID, testOrgA.ID);
            Assert.AreNotEqual(actual.Status, SchemaObjectStatus.Normal);
        }
예제 #17
0
        public void AdminUpdateOrganizationTest()
        {
            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.UpdateOrganization(testOrg);
        }
예제 #18
0
        public void AdminAddGroupTest()
        {
            this.InitAdmins();

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

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

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

            Facade.AddOrganization(testOrg, mainOrg);

            FacadeWithAcl.AddGroup(testGrp, testOrg);

            var actual = GetGroupByCodeName(testGrp.CodeName);

            Assert.IsNotNull(actual);
        }
예제 #19
0
        public void AdminUpdateUserTest()
        {
            this.InitAdmins();

            var mainRole  = this.CreateDefaultRoleWithMembers(this.GetSCUsersByCodeNames("wanglch"));
            var mainOrg   = this.GetOrganizationByCodeName("costEngineer");
            var testOrgA  = NewObject <PC.SCOrganization>("测试组织A");
            var testOrgB  = NewObject <PC.SCOrganization>("测试组织B");
            var testUserA = this.NewObject <PC.SCUser>("测试用户A");


            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB, mainOrg);
            Facade.AddUser(testUserA, testOrgA);
            Facade.AddUserToOrganization(testUserA, testOrgB);

            FacadeWithAcl.UpdateUser(testUserA);
        }
예제 #20
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);
        }
예제 #21
0
        public void AdminAddOrganizationTest()
        {
            InitAdmins();

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

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

            Facade.AddOrganization(orgParent, mainOrg);

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

            FacadeWithAcl.AddOrganization(testOrg, orgParent);

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

            Assert.IsNotNull(actual);

            Assert.AreEqual(actual.Status, SchemaObjectStatus.Normal);
        }
예제 #22
0
        public void AdminRemoveUserFromOrgTest()
        {
            InitAdmins();

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

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

            Facade.AddOrganization(testOrg, mainOrg);

            var testUser = NewObject <PC.SCUser>("测试用户");

            Facade.AddUser(testUser, testOrg);

            FacadeWithAcl.DeleteUser(testUser, testOrg, true);

            var relation = PC.Adapters.SchemaRelationObjectAdapter.Instance.Load(testOrg.ID, testUser.ID);

            Assert.IsTrue(relation == null || relation.Status != SchemaObjectStatus.Normal);
        }
예제 #23
0
        public void LegalUpdateUserTest()
        {
            this.InitAdmins();

            var mainRole  = this.CreateDefaultRoleWithMembers(this.GetSCUsersByCodeNames("wanglch"));
            var mainOrg   = this.GetOrganizationByCodeName("costEngineer");
            var testOrgA  = NewObject <PC.SCOrganization>("测试组织A");
            var testOrgB  = NewObject <PC.SCOrganization>("测试组织B");
            var testUserA = this.NewObject <PC.SCUser>("测试用户A");

            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB, mainOrg);
            Facade.AddUser(testUserA, testOrgA);
            Facade.AddUserToOrganization(testUserA, testOrgB);

            SetContainerMemberAndPermissions(testOrgA, mainRole, new string[] { "UpdateChildren" });

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

            FacadeWithAcl.UpdateUser(testUserA);
        }
예제 #24
0
        public void LegalUpdateOrganizationTest()
        {
            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(orgParent, mainRole, new string[] { "UpdateChildren" });

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

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

            Facade.AddOrganization(testOrg, orgParent);

            FacadeWithAcl.UpdateOrganization(testOrg);
        }
예제 #25
0
        public void IllegalAddSecretaryTest1()
        {
            InitAdmins();

            var mainRole  = this.CreateDefaultRoleWithMembers(this.GetSCUsersByCodeNames("wanglch"));
            var mainOrg   = this.GetOrganizationByCodeName("costEngineer");
            var testOrgA  = NewObject <PC.SCOrganization>("测试组织A");
            var testOrgB  = NewObject <PC.SCOrganization>("测试组织B");
            var testUserA = this.NewObject <PC.SCUser>("测试用户A");
            var testUserB = this.NewObject <PC.SCUser>("测试用户B");

            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB, mainOrg);
            Facade.AddUser(testUserA, testOrgA);
            Facade.AddUser(testUserB, testOrgB);

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

            FacadeWithAcl.AddSecretaryToUser(testUserA, testUserB);

            Assert.Fail("不应执行到此");
        }
예제 #26
0
        public void AdminAddUserToOrganizationTest()
        {
            InitAdmins();

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

            var mainApp = this.CreateDefaultApp();

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

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

            Facade.AddOrganization(testOrg, mainOrg);

            var testUser = this.NewObject <PC.SCUser>("测试用户");

            Facade.AddUser(testUser, null);

            FacadeWithAcl.AddUserToOrganization(testUser, testOrg);

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

            Assert.IsNotNull(actual);
        }