private void throwExceptionIfSafetyRestrictionsAreViolated ( CmsObject cms , CmsSolrQuery query , boolean isSpell ) throws CmsSearchException { if ( ! isDebug ( cms , query ) ) { if ( isSpell ) { if ( m_handlerSpellDisabled ) { throw new CmsSearchException ( Messages . get ( ) . container ( Messages . GUI_HANDLER_REQUEST_NOT_ALLOWED_0 ) ) ; } } else { if ( m_handlerSelectDisabled ) { throw new CmsSearchException ( Messages . get ( ) . container ( Messages . GUI_HANDLER_REQUEST_NOT_ALLOWED_0 ) ) ; } int start = null != query . getStart ( ) ? query . getStart ( ) . intValue ( ) : 0 ; int rows = null != query . getRows ( ) ? query . getRows ( ) . intValue ( ) : CmsSolrQuery . DEFAULT_ROWS . intValue ( ) ; if ( ( m_handlerMaxAllowedResultsAtAll >= 0 ) && ( ( rows + start ) > m_handlerMaxAllowedResultsAtAll ) ) { throw new CmsSearchException ( Messages . get ( ) . container ( Messages . GUI_HANDLER_TOO_MANY_RESULTS_REQUESTED_AT_ALL_2 , Integer . valueOf ( m_handlerMaxAllowedResultsAtAll ) , Integer . valueOf ( rows + start ) ) ) ; } if ( ( m_handlerMaxAllowedResultsPerPage >= 0 ) && ( rows > m_handlerMaxAllowedResultsPerPage ) ) { throw new CmsSearchException ( Messages . get ( ) . container ( Messages . GUI_HANDLER_TOO_MANY_RESULTS_REQUESTED_PER_PAGE_2 , Integer . valueOf ( m_handlerMaxAllowedResultsPerPage ) , Integer . valueOf ( rows ) ) ) ; } if ( ( null != m_handlerAllowedFields ) && ( Stream . of ( m_handlerAllowedFields ) . anyMatch ( x -> true ) ) ) { if ( query . getFields ( ) . equals ( CmsSolrQuery . ALL_RETURN_FIELDS ) ) { query . setFields ( m_handlerAllowedFields ) ; } else { for ( String requestedField : query . getFields ( ) . split ( "," ) ) { if ( Stream . of ( m_handlerAllowedFields ) . noneMatch ( allowedField -> allowedField . equals ( requestedField ) ) ) { throw new CmsSearchException ( Messages . get ( ) . container ( Messages . GUI_HANDLER_REQUESTED_FIELD_NOT_ALLOWED_2 , requestedField , Stream . of ( m_handlerAllowedFields ) . reduce ( "" , ( a , b ) -> a + "," + b ) ) ) ; } } } } } } }
Throws an exception if the request can for security reasons not be performed . Security restrictions can be set via parameters of the index .