public void InitialData_FW_Permissions_Apply() { var initialData = new InitialData { Permissions = new List <string> { "+6|Normal|-6:_______________________________________________________________+", "-1000|Normal|+6:_______________________________________________________________+", } }; InitialSecurityDataTest(() => { var mask = PermissionType.GetPermissionMask(PermissionType.BuiltInPermissionTypes); SecurityHandler.CreateAclEditor() .RemoveExplicitEntries(2) .RemoveExplicitEntries(6) .RemoveExplicitEntries(1000) .Set(2, 7, false, mask, 0UL) .Apply(); // PRECHECKS // Administrators group has 1 entry on the Root. Assert.AreEqual(1, SecurityHandler.GetExplicitEntries(2, new[] { 7 }).Count); // Visitor has no any permission. Assert.IsFalse(SecurityHandler.HasPermission(User.Visitor, 6, PermissionType.See)); Assert.IsFalse(SecurityHandler.HasPermission(User.Visitor, 1000, PermissionType.See)); // There is no break. Assert.IsTrue(SecurityHandler.IsEntityInherited(6)); Assert.IsTrue(SecurityHandler.IsEntityInherited(1000)); // ACTION SecurityHandler.SecurityInstaller.InstallDefaultSecurityStructure(initialData); // ASSERT // Administrators group has an entry on the Root. Assert.AreEqual(1, SecurityHandler.GetExplicitEntries(2, new[] { 7 }).Count); // Visitor has See permission on both contents. Assert.IsTrue(SecurityHandler.HasPermission(User.Visitor, 6, PermissionType.See)); Assert.IsTrue(SecurityHandler.HasPermission(User.Visitor, 1000, PermissionType.See)); // The second content is not inherited. Assert.IsTrue(SecurityHandler.IsEntityInherited(6)); Assert.IsFalse(SecurityHandler.IsEntityInherited(1000)); }); }
public void InitialData_Permissions_Apply() { var initialData = new InitialData { Permissions = new List <string> { "+6|Normal|-6:_______________________________________________________________+", "-1113|Normal|+6:_______________________________________________________________+", } }; InitialSecurityDataTest(() => { // PRECHECKS // Administrators group has 1 entry on the Root. Assert.AreEqual(1, SecurityHandler.GetExplicitEntries(2, new[] { 7 }).Count); // Visitor has no any permission. Assert.IsFalse(SecurityHandler.HasPermission(User.Visitor, 6, PermissionType.See)); Assert.IsFalse(SecurityHandler.HasPermission(User.Visitor, 1113, PermissionType.See)); // There is no break. Assert.IsTrue(SecurityHandler.IsEntityInherited(6)); Assert.IsTrue(SecurityHandler.IsEntityInherited(1113)); // ACTION SecurityHandler.SecurityInstaller.InstallDefaultSecurityStructure(initialData); // ASSERT // Administrators group has an entry on the Root. Assert.AreEqual(1, SecurityHandler.GetExplicitEntries(2, new[] { 7 }).Count); // Visitor has See permission on both contents. Assert.IsTrue(SecurityHandler.HasPermission(User.Visitor, 6, PermissionType.See)); Assert.IsTrue(SecurityHandler.HasPermission(User.Visitor, 1113, PermissionType.See)); // The second content is not inherited. Assert.IsTrue(SecurityHandler.IsEntityInherited(6)); Assert.IsFalse(SecurityHandler.IsEntityInherited(1113)); }); }