Beispiel #1
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);
        }
Beispiel #2
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);
        }