use of com.ibm.xsp.acl.NoAccessSignal in project org.openntf.domino by OpenNTF.
the class OpenntfDominoDocumentData method createDocument.
/**
* creates a new document and wraps it in an OpenntfDominoDocument
*
* @return
* @throws NotesException
*/
protected OpenntfDominoDocument createDocument() throws NotesException {
Database db = openDatabase();
String server = com.ibm.xsp.model.domino.DominoUtils.getCurrentDatabase().getServer();
if (!(StringUtil.isEmpty(server))) {
String currentUser = com.ibm.xsp.model.domino.DominoUtils.getCurrentSession().getEffectiveUserName();
int i = db.queryAccessPrivileges(currentUser);
if (((i & Database.DBACL_CREATE_DOCS) == 0) && ((i & Database.DBACL_WRITE_PUBLIC_DOCS) == 0)) {
throw new NoAccessSignal("User " + currentUser + " is has not enough privileges to create documents in " + getDatabaseName());
}
}
DominoDocument dominoDoc = DominoDocument.wrap(getDatabaseName(), db, getParentId(), getFormName(), getComputeWithForm(), getConcurrencyMode(), isAllowDeletedDocs(), getSaveLinksAs(), getWebQuerySaveAgent());
OpenntfDominoDocument ntfDoc = wrap(dominoDoc, true);
ntfDoc.setEditable(true);
return ntfDoc;
}
use of com.ibm.xsp.acl.NoAccessSignal in project org.openntf.xsp.jakartaee by OpenNTF.
the class RolesAllowedFilter method filter.
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
if (!isAllowed(requestContext)) {
NoAccessSignal signal = new NoAccessSignal();
signal.setStackTrace(new StackTraceElement[0]);
throw signal;
}
}
use of com.ibm.xsp.acl.NoAccessSignal in project org.openntf.xsp.jakartaee by OpenNTF.
the class AbstractXspLifecycleServlet method service.
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setBufferSize(0);
initializeSessionAsSigner();
FacesContext facesContext = null;
try {
if (!initialized) {
// initialization has do be done after NotesContext is initialized with session to support SessionAsSigner operations
doInit(config);
initialized = true;
}
facesContext = getFacesContext(request, response);
FacesContextEx exc = (FacesContextEx) facesContext;
ApplicationEx application = exc.getApplicationEx();
this.doService(request, response, application);
} catch (NoAccessSignal t) {
throw t;
} catch (Throwable t) {
try (PrintWriter w = response.getWriter()) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
XSPErrorPage.handleException(w, t, request.getRequestURL().toString(), false);
} catch (javax.servlet.ServletException e) {
throw new IOException(e);
} catch (IllegalStateException e) {
// Happens when the writer or output has already been opened
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
} finally {
if (facesContext != null) {
releaseContext(facesContext);
}
}
}
Aggregations