ImpersonationImpl implements Impersonation, UserConstants { @Override public boolean revokeImpersonation(@NotNull Principal principal) throws RepositoryException { String pName = principal.getName(); user.getUserManager().onImpersonation(user, principal, false); Tree userTree = user.getTree(); Set<String> impersonators = getImpersonatorNames(userTree); if (impersonators.remove(pName)) { updateImpersonatorNames(userTree, impersonators); return true; } else { return false; } } ImpersonationImpl(@NotNull UserImpl user); @NotNull @Override PrincipalIterator getImpersonators(); @Override boolean grantImpersonation(@NotNull Principal principal); @Override boolean revokeImpersonation(@NotNull Principal principal); @Override boolean allows(@NotNull Subject subject);  }
@Test public void testRevoke() throws Exception { assertTrue(impersonation.revokeImpersonation(impersonator.getPrincipal())); }