I'm trying to permit users to write note to any node it's able to see. I found the code of creating note from com.openkm.dao.NodeNoteDAO.java. I commented out the SecurityHelper.checkWrite(parentNode); -> getting building error "error: exception AccessDeniedException is never thrown in body of corresponding try statement" -> removed the AccessDeniedException from create-function and commented out the catch -> I was able to build, but it didn't affect anything, still not able to write notes on documents that I only have read access (Text-area doesn't even appear).
Code: Select all
/**
* Create
public void create(NodeNote nNote) throws PathNotFoundException, AccessDeniedException, DatabaseException {
log.debug("create({})", nNote);
Session session = null;
Transaction tx = null;
*/
public void create(NodeNote nNote) throws PathNotFoundException, DatabaseException {
log.debug("create({})", nNote);
Session session = null;
Transaction tx = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
tx = session.beginTransaction();
// Security Check
NodeBase parentNode = (NodeBase) session.load(NodeBase.class, nNote.getParent());
SecurityHelper.checkRead(parentNode);
/* SecurityHelper.checkWrite(parentNode); */
session.save(nNote);
HibernateUtil.commit(tx);
log.debug("create: void");
} catch (PathNotFoundException e) {
HibernateUtil.rollback(tx);
throw e;
}
/* catch (AccessDeniedException e) {
HibernateUtil.rollback(tx);
throw e;
} */
catch (DatabaseException e) {
HibernateUtil.rollback(tx);
throw e;
} catch (HibernateException e) {
HibernateUtil.rollback(tx);
throw new DatabaseException(e.getMessage(), e);
} finally {
HibernateUtil.close(session);
}
}