Search in sources :

Example 1 with NoAccessSignal

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;
}
Also used : Database(lotus.domino.Database) NoAccessSignal(com.ibm.xsp.acl.NoAccessSignal) DominoDocument(com.ibm.xsp.model.domino.wrapped.DominoDocument)

Example 2 with NoAccessSignal

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;
    }
}
Also used : NoAccessSignal(com.ibm.xsp.acl.NoAccessSignal)

Example 3 with NoAccessSignal

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);
        }
    }
}
Also used : ServletException(jakarta.servlet.ServletException) FacesContext(javax.faces.context.FacesContext) FacesContextEx(com.ibm.xsp.context.FacesContextEx) ApplicationEx(com.ibm.xsp.application.ApplicationEx) NoAccessSignal(com.ibm.xsp.acl.NoAccessSignal) IOException(java.io.IOException) PrintWriter(java.io.PrintWriter)

Aggregations

NoAccessSignal (com.ibm.xsp.acl.NoAccessSignal)3 ApplicationEx (com.ibm.xsp.application.ApplicationEx)1 FacesContextEx (com.ibm.xsp.context.FacesContextEx)1 DominoDocument (com.ibm.xsp.model.domino.wrapped.DominoDocument)1 ServletException (jakarta.servlet.ServletException)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 FacesContext (javax.faces.context.FacesContext)1 Database (lotus.domino.Database)1