示例#1
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);
        }
示例#2
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);
        }
示例#3
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);
        }
示例#4
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);
        }