public void TestOfAdminCreatePermission() { InitAdmins(); var mainApp = this.CreateDefaultApp(); var testPermission = base.NewObject <SCPermission>("测试权限"); FacadeWithAcl.AddPermission(testPermission, mainApp); Assert.IsNotNull((PC.SCPermission)PC.Adapters.SchemaObjectAdapter.Instance.Load(testPermission.ID), "未创建权限"); }
public void TestOfIllegalCreatePermission() { this.InitAdmins(); var mainApp = this.CreateDefaultApp(); var mainRole = this.CreateDefaultRoleWithMembers(this.GetSCUsersByCodeNames("wanglch")); base.SetContainerMemberAndPermissions(mainApp, mainRole, new string[] { "AddPermissions" }); this.SetCurrentPrincipal(this.GetUserByCodeName("chenke")); var testPermission = NewObject <SCPermission>("测试权限"); FacadeWithAcl.AddPermission(testPermission, mainApp); Assert.Fail("不应该执行到此"); }
public void TestOfCreatePermission() { this.InitAdmins(); var mainApp = this.CreateDefaultApp(); var mainRole = this.CreateDefaultRoleWithMembers(this.GetSCUsersByCodeNames("wanglch")); base.SetContainerMemberAndPermissions(mainApp, mainRole, new string[] { "AddPermissions" }); this.SetCurrentPrincipal(this.GetUserByCodeName("wanglch")); var testPermission = NewObject <SCPermission>("测试权限"); FacadeWithAcl.AddPermission(testPermission, mainApp); //应该创建成功 Assert.IsNotNull((PC.SCPermission)PC.Adapters.SchemaObjectAdapter.Instance.Load(testPermission.ID), "未创建权限"); }