*/
public class TestUserPageACL extends AbstractTestUserACL
{
public void testUserPageIsAlwaysUsableOnlyByItsOwner()
{
Page page = new Page();
page.setOwnerType("user");
page.setOwnerId("user");
page.setAccessPermissions(new String[0]);
assertTrue(root.hasPermission(page));
assertFalse(administrator.hasPermission(page));
assertFalse(manager.hasPermission(page));
assertTrue(user.hasPermission(page));
assertFalse(guest.hasPermission(page));
assertFalse(root.hasEditPermission(page));
assertFalse(administrator.hasEditPermission(page));
assertFalse(manager.hasEditPermission(page));
assertTrue(user.hasEditPermission(page));
assertFalse(guest.hasEditPermission(page));
//
page = new Page();
page.setOwnerType("user");
page.setOwnerId("user");
page.setAccessPermissions(new String[]{"manager:/manageable"});
assertTrue(root.hasPermission(page));
assertFalse(administrator.hasPermission(page));
assertTrue(manager.hasPermission(page));
assertTrue(user.hasPermission(page));
assertFalse(guest.hasPermission(page));
assertFalse(root.hasEditPermission(page));
assertFalse(administrator.hasEditPermission(page));
assertFalse(manager.hasEditPermission(page));
assertTrue(user.hasEditPermission(page));
assertFalse(guest.hasEditPermission(page));
//
page = new Page();
page.setOwnerType("user");
page.setOwnerId("user");
page.setEditPermission("manager:/manageable");
assertTrue(root.hasPermission(page));
assertFalse(administrator.hasPermission(page));
assertFalse(manager.hasPermission(page));
assertFalse(manager.hasPermission(page));
assertTrue(user.hasPermission(page));
assertFalse(guest.hasPermission(page));
assertFalse(root.hasEditPermission(page));
assertFalse(administrator.hasEditPermission(page));
assertFalse(manager.hasEditPermission(page));
assertTrue(user.hasEditPermission(page));
assertFalse(guest.hasEditPermission(page));
//
page = new Page();
page.setOwnerType("user");
page.setOwnerId("user");
page.setAccessPermissions(new String[]{"Everyone"});
assertTrue(root.hasPermission(page));
assertTrue(administrator.hasPermission(page));
assertTrue(manager.hasPermission(page));
assertTrue(user.hasPermission(page));
assertTrue(guest.hasPermission(page));
assertFalse(root.hasEditPermission(page));
assertFalse(administrator.hasEditPermission(page));
assertFalse(manager.hasEditPermission(page));
assertTrue(user.hasEditPermission(page));
assertFalse(guest.hasEditPermission(page));
//
page = new Page();
page.setOwnerType("user");
page.setOwnerId("user");
page.setAccessPermissions(new String[0]);
page.setEditPermission("Everyone");
assertTrue(root.hasPermission(page));
assertFalse(administrator.hasPermission(page));
assertFalse(manager.hasPermission(page));
assertTrue(user.hasPermission(page));
assertFalse(guest.hasPermission(page));