Changeset 7007


Ignore:
Timestamp:
Nov 11, 2015, 11:35:21 AM (7 years ago)
Author:
Nicklas Nordborg
Message:

References #1964: No such filter configured [denyAllRAWDATA]

Preliminary fix for this problem by not using filters for queries that use the stateless session (DataQuery and ReportScoreQuery).

Solving the problem with getting access to reports without permission (#1965) may require changes to this fix.

Location:
branches/3.6-stable/src/core/net/sf/basedb/core
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.6-stable/src/core/net/sf/basedb/core/AbstractEntityQuery.java

    r6934 r7007  
    126126      if the regular Hibernate session should be used
    127127    @param optionalFilter A runtime filter replacing the default optional filter
    128       or null to not use any optional filter
     128      or null to not use any optional filter (not supported for stateless sessions)
    129129  */
    130130  AbstractEntityQuery(Item returnType, String entityName, boolean stateless, QueryRuntimeFilter optionalFilter)
     
    146146    this.returnType = returnType;
    147147    this.rootType = rootType;
    148     this.requiredFilter = QueryRuntimeFilterFactory.getRequiredFilter(rootType);
    149     this.optionalFilter = optionalFilter;
     148    this.requiredFilter = stateless ? null : QueryRuntimeFilterFactory.getRequiredFilter(returnType);
     149    this.optionalFilter = stateless ? null : optionalFilter;
    150150    this.includes = EnumSet.of(Include.NOT_REMOVED, Include.MINE, Include.IN_PROJECT,
    151151        Include.ANNOTATED, Include.NOT_ANNOTATED);
     
    357357  void enableFilters(DbControl dc)
    358358  {
    359     if (requiredFilter != null || optionalFilter != null)
     359    if (!isStateless() && (requiredFilter != null || optionalFilter != null))
    360360    {
    361361      filterManager = new QueryRuntimeFilterManager(dc, getItemType());
  • branches/3.6-stable/src/core/net/sf/basedb/core/DataQuery.java

    r4889 r7007  
    7676  DataQuery(Class<I> dataClass, Item rootType, String rootName, String select)
    7777  {
    78     super(Item.fromDataClass(dataClass), rootType, rootName, select, true,
    79       QueryRuntimeFilterFactory.getOptionalFilter(rootType));
     78    super(Item.fromDataClass(dataClass), rootType, rootName, select, true, null);
    8079    this.dataClass = dataClass;
    8180  }
    8281 
    83   /**
    84     Create a new query for the specified item, using a non-default optional
    85     runtime filter.
    86     @param dataClass The class of the data objects that are returned
    87     @param optionalFilter A runtime filter replacing the default optional filter
    88       or null to not use any optional filter
    89   */
    90   DataQuery(Class<I> dataClass, String entityName, QueryRuntimeFilter optionalFilter)
    91   {
    92     super(Item.fromDataClass(dataClass), entityName, true, optionalFilter);
    93     this.dataClass = dataClass;
    94   }
    95 
    9682  /**
    9783    Execute the query and return the results as an iterator.
     
    10692    ScrollIterator<I> result = null;
    10793    SessionControl sc = dc.getSessionControl();
    108     enableFilters(dc);
    10994    try
    11095    {
     
    124109      throw new SignalException("Aborted by user", ex);
    125110    }
    126     finally
    127     {
    128       disableFilters(dc);
    129     }
    130111   
    131112    return new DataResultIterator<I>(result,
  • branches/3.6-stable/src/core/net/sf/basedb/core/ReporterScoreQuery.java

    r4517 r7007  
    6060    ScrollIterator<ReporterListScoreData> result = null;
    6161    SessionControl sc = dc.getSessionControl();
    62     enableFilters(dc);
     62
    6363    try
    6464    {
     
    7878      throw new SignalException("Aborted by user", ex);
    7979    }
    80     finally
    81     {
    82       disableFilters(dc);
    83     }
    8480    return new ReporterScoreResultIterator(result, dc, totalCount);   
    8581  }
Note: See TracChangeset for help on using the changeset viewer.