コード例 #1
0
        public void TestOfAdminCreateRole()
        {
            InitAdmins();

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

            var mainApp = this.CreateDefaultApp();

            var testRole = base.NewObject <SCRole>("测试角色");

            FacadeWithAcl.AddRole(testRole, mainApp);

            Assert.IsNotNull((PC.SCRole)PC.Adapters.SchemaObjectAdapter.Instance.Load(testRole.ID), "未创建角色");
        }
コード例 #2
0
        public void TestOfIllegalCreateRole()
        {
            InitAdmins();

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

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

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

            var testRole = NewObject <SCRole>("测试角色");

            FacadeWithAcl.AddRole(testRole, mainApp);
            Assert.Fail("不应该执行到此");
        }
コード例 #3
0
        public void TestOfCreateRole()
        {
            InitAdmins();

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

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

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

            var testRole = NewObject <SCRole>("测试角色");

            FacadeWithAcl.AddRole(testRole, mainApp);

            //应该创建成功

            Assert.IsNotNull((PC.SCRole)PC.Adapters.SchemaObjectAdapter.Instance.Load(testRole.ID), "未创建角色");
        }