save(superuser);
}
}
public void testImpersonationOfOtherUser() throws RepositoryException, NotExecutableException {
UserManager umgr = getUserManager(uSession);
Principal selfPrinc = umgr.getAuthorizable(uID).getPrincipal();
User child = (User) umgr.getAuthorizable(getYetAnotherID());
Impersonation impers = child.getImpersonation();
assertFalse(impers.allows(buildSubject(selfPrinc)));
try {
assertFalse(impers.grantImpersonation(selfPrinc));
save(uSession);
} catch (AccessDeniedException e) {
// ok.
}
assertFalse(impers.allows(buildSubject(selfPrinc)));
User parent = (User) umgr.getAuthorizable(otherUID);
impers = parent.getImpersonation();
assertFalse(impers.allows(buildSubject(selfPrinc)));
try {
assertFalse(impers.grantImpersonation(selfPrinc));
save(uSession);