Esempio n. 1
0
        public void TestOfIllegalAddRoleMembers()
        {
            this.InitAdmins();

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

            base.SetContainerMemberAndPermissions(mainApp, mainRole, new string[] { "ModifyMembersInRoles" });

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

            var fanhy = GetSCUserByCodeName("fanhy");

            FacadeWithAcl.AddMemberToRole(fanhy, mainRole);

            Assert.Fail("不应该执行到此");
        }
Esempio n. 2
0
        public void TestOfAddRoleMembers()
        {
            this.InitAdmins();

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

            base.SetContainerMemberAndPermissions(mainApp, mainRole, new string[] { "ModifyMembersInRoles" });

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

            var fanhy = GetSCUserByCodeName("fanhy");

            FacadeWithAcl.AddMemberToRole(fanhy, mainRole);

            var members = PC.Adapters.SCMemberRelationAdapter.Instance.LoadByContainerID(mainRole.ID);

            Assert.IsTrue((from m in members where m.ID == fanhy.ID select m).Any());
        }
Esempio n. 3
0
        public void TestOfAdminAddRoleMembers()
        {
            this.InitAdmins();

            var mainApp = this.CreateDefaultApp();

            var mainRole = this.CreateDefaultRole();

            Facade.AddUser(new SCUser()
            {
                ID = Guid.NewGuid().ToString(), Name = "范海燕", CodeName = "fanhy", DisplayName = "fanyh"
            }, SCOrganization.GetRoot());

            var fanhy = GetSCUserByCodeName("fanhy");

            FacadeWithAcl.AddMemberToRole(fanhy, mainRole);

            var members = PC.Adapters.SCMemberRelationAdapter.Instance.LoadByContainerID(mainRole.ID);

            Assert.IsTrue((from m in members where m.ID == fanhy.ID select m).Any());
        }