testUserMarking(AccessType.DENY, AccessRight.NONE_AS_INT, false,
AccessRight.DELETE, AccessRight.WRITE, AccessRight.WRITE_ACL);
}
public void testMarking_NoUseRight_HavingBothAllowAndDeny() {
IUser user1 = MockUtil.createUserWithDomain("user1", "foo.example.com");
AccessPermissionMock perm1 =
new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
perm1.set_AccessType(AccessType.ALLOW);
perm1.set_AccessMask(AccessRight.NONE_AS_INT);
perm1.set_GranteeType(SecurityPrincipalType.USER);
perm1.set_GranteeName(user1.get_Name());
perms.add(perm1);
// The access mask can be set to any value for DENY as it does not have any
// effects.
AccessPermissionMock perm2 =
new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
perm2.set_AccessType(AccessType.DENY);
perm2.set_AccessMask(VIEW_ACCESS_RIGHTS);
perm2.set_GranteeType(SecurityPrincipalType.USER);
perm2.set_GranteeName(user1.get_Name());
perms.add(perm2);
Permissions testPerms = new Permissions(perms);
assertEquals(true, testPerms.authorizeMarking(user1,
constraintMask(AccessRight.VIEW_CONTENT, AccessRight.READ)));