Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public void beforeDeleteData(List<ExpData> data, User user) throws ExperimentExc
domain = provider.getResultsDomain(protocol);

AssayProtocolSchema assayProtocolSchema = provider.createProtocolSchema(user, protocol.getContainer(), protocol, null);
TableInfo assayDataTable = assayProtocolSchema.createDataTable(ContainerFilter.EVERYTHING_UNSAFE, false);
TableInfo assayDataTable = assayProtocolSchema.createDataTable(ContainerFilter.getUnsafeEverythingFilter(), false);
if (assayDataTable != null)
{
ColumnInfo lsidCol = assayDataTable.getColumn(assayResultLsidFieldKey);
Expand Down
15 changes: 14 additions & 1 deletion api/src/org/labkey/api/data/ContainerFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,21 @@ public static ContainerFilter current(ContainerUser cu)
}

/** Use this with extreme caution - this doesn't check permissions */
@Deprecated(forRemoval = true) // Use getUnsafeEverythingFilter() instead TODO: Remove
public static final ContainerFilter EVERYTHING_UNSAFE = new InternalNoContainerFilter();

private static ContainerFilter _everythingUnsafe = null;

/** Use this with extreme caution - this doesn't check permissions! */
public static synchronized ContainerFilter getUnsafeEverythingFilter()
{
if (_everythingUnsafe == null)
{
_everythingUnsafe = new InternalNoContainerFilter();
}
return _everythingUnsafe;
}

public static class ContainerFilterWithPermission extends ContainerFilter
{
public ContainerFilterWithPermission(Container c, User user)
Expand Down Expand Up @@ -1346,7 +1359,7 @@ public void testCacheKey()
assertEquals(current(home, user).getCacheKey(), current(home, user).getCacheKey());
assertNotEquals(current(home, user).getCacheKey(), current(test, user).getCacheKey());

assertEquals(EVERYTHING_UNSAFE.getCacheKey(), new InternalNoContainerFilter().getCacheKey());
assertEquals(getUnsafeEverythingFilter().getCacheKey(), new InternalNoContainerFilter().getCacheKey());

assertEquals(new CurrentPlusExtras(home, user, shared).getCacheKey(), new CurrentPlusExtras(home, user, shared).getCacheKey());
assertNotEquals(new CurrentPlusExtras(home, user, shared).getCacheKey(), new CurrentPlusExtras(test, user, shared).getCacheKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ protected void initColumn(MutableColumnInfo col)
public TableInfo getLookupTableInfo()
{
DomainAuditProvider provider = new DomainAuditProvider();
TableInfo table = provider.createTableInfo(getUserSchema(), ContainerFilter.EVERYTHING_UNSAFE);
TableInfo table = provider.createTableInfo(getUserSchema(), ContainerFilter.getUnsafeEverythingFilter());
return table;
}
});
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/exp/property/DomainUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ private static void updateTextChoiceValueRows(Domain domain, User user, String p
if (domain != null && domain.getDomainKind() != null)
{
// using ContainerFilter.EVERYTHING to account for /Shared domains
TableInfo domainTable = domain.getDomainKind().getTableInfo(user, domain.getContainer(), domain, ContainerFilter.EVERYTHING_UNSAFE);
TableInfo domainTable = domain.getDomainKind().getTableInfo(user, domain.getContainer(), domain, ContainerFilter.getUnsafeEverythingFilter());
if (domainTable != null && domainTable.getUpdateService() != null)
{
// we need to make all the row updates for this domain property at one time to prevent the
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/exp/query/ExpSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ public ForeignKey getProtocolForeignKey(ContainerFilter cf, String targetColumnN
@Override
public TableInfo getLookupTableInfo()
{
return getTable(TableType.Protocols.toString(), ContainerFilter.EVERYTHING_UNSAFE);
return getTable(TableType.Protocols.toString(), ContainerFilter.getUnsafeEverythingFilter());
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/exp/query/SamplesSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public SamplesSchema(QuerySchema schema, boolean studyLinkedSamples)

if (studyLinkedSamples)
{
this.setContainerFilter(ContainerFilter.EVERYTHING_UNSAFE);
this.setContainerFilter(ContainerFilter.getUnsafeEverythingFilter());
this.withLinkToStudyColumns = false;
this.supportTableRules = false;
this.contextualRoles = Set.of(RoleManager.getRole(ReaderRole.class));
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/query/PrincipalIdForeignKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public TableInfo getLookupTableInfo()
{
TableInfo tinfoUsersData = CoreSchema.getInstance().getTableInfoPrincipals();
FilteredTable<UserSchema> ret = new FilteredTable<>(tinfoUsersData, _userSchema);
ret.setContainerFilter(ContainerFilter.EVERYTHING_UNSAFE);
ret.setContainerFilter(ContainerFilter.getUnsafeEverythingFilter());
ret.addWrapColumn(tinfoUsersData.getColumn("UserId"));
ret.addColumn(ret.wrapColumn("Name", tinfoUsersData.getColumn("Name")));
ret.setTitleColumn("Name");
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/study/assay/SpecimenForeignKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void _initAssayColumns()
if (null == _assayDataTable)
{
AssayProtocolSchema assaySchema = _provider.createProtocolSchema(_schema.getUser(), _schema.getContainer(), _protocol, null);
_assayDataTable = assaySchema.createDataTable(ContainerFilter.EVERYTHING_UNSAFE);
_assayDataTable = assaySchema.createDataTable(ContainerFilter.getUnsafeEverythingFilter());
}

FieldKey specimenFK = _tableMetadata.getSpecimenIDFieldKey();
Expand Down
2 changes: 1 addition & 1 deletion assay/src/org/labkey/assay/AssayController.java
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,7 @@ public Object execute(AssayOperationConfirmationForm form, BindException errors)
ExpProtocol protocol = service.getExpProtocol(form.getProtocolId());
AssayProvider provider = AssayService.get().getProvider(protocol);
AssaySchema schema = provider.createProtocolSchema(getUser(), getContainer(), protocol, null);
TableInfo tableInfo = schema.getTableOrThrow(AssayProtocolSchema.DATA_TABLE_NAME, ContainerFilter.EVERYTHING_UNSAFE);
TableInfo tableInfo = schema.getTableOrThrow(AssayProtocolSchema.DATA_TABLE_NAME, ContainerFilter.getUnsafeEverythingFilter());

// need to query to get the dataIds for the data rowIds so that we can check container permissions on that exp.data table
SimpleFilter filter = new SimpleFilter(FieldKey.fromParts("RowId"), allowedIds, CompareType.IN);
Expand Down
4 changes: 2 additions & 2 deletions assay/src/org/labkey/assay/AssayUpgradeCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public static void populatePlateSetPaths(ModuleContext ctx) throws Exception
ContainerManager.getRoot(),
User.getAdminServiceUser(),
plateSetRowId,
ContainerFilter.EVERYTHING_UNSAFE
ContainerFilter.getUnsafeEverythingFilter()
);
String lineagePath = lineage.getSeedPath();

Expand Down Expand Up @@ -676,7 +676,7 @@ public static void updateBuiltInColumns(ModuleContext ctx)

for (Integer plateSetId : plateSetIds)
{
PlateSet plateSet = PlateService.get().getPlateSet(ContainerFilter.EVERYTHING_UNSAFE, plateSetId);
PlateSet plateSet = PlateService.get().getPlateSet(ContainerFilter.getUnsafeEverythingFilter(), plateSetId);
if (plateSet == null)
throw new IllegalStateException("updateBuiltInColumns: Plate Set with plate of id " + plateSetId + " not found.");

Expand Down
8 changes: 4 additions & 4 deletions assay/src/org/labkey/assay/plate/PlateManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ public Map<Integer, Long> getPlateRunCounts(@NotNull Container c, @NotNull User
for (ExpProtocol protocol : protocols)
{
AssayProtocolSchema assayProtocolSchema = provider.createProtocolSchema(user, protocol.getContainer(), protocol, null);
TableInfo assayDataTable = assayProtocolSchema.createDataTable(ContainerFilter.EVERYTHING_UNSAFE, false);
TableInfo assayDataTable = assayProtocolSchema.createDataTable(ContainerFilter.getUnsafeEverythingFilter(), false);
if (assayDataTable != null)
{
ColumnInfo dataIdCol = assayDataTable.getColumn("DataId");
Expand Down Expand Up @@ -612,7 +612,7 @@ private int getRunCountUsingPlateInResults(@NotNull Container c, @NotNull User u
for (ExpProtocol protocol : protocols)
{
AssayProtocolSchema assayProtocolSchema = provider.createProtocolSchema(user, protocol.getContainer(), protocol, null);
TableInfo assayDataTable = assayProtocolSchema.createDataTable(ContainerFilter.EVERYTHING_UNSAFE, false);
TableInfo assayDataTable = assayProtocolSchema.createDataTable(ContainerFilter.getUnsafeEverythingFilter(), false);
if (assayDataTable != null)
{
ColumnInfo dataIdCol = assayDataTable.getColumn("DataId");
Expand Down Expand Up @@ -3192,7 +3192,7 @@ public void markHits(
if (plateSet == null)
throw new ValidationException(String.format("Failed to mark hits. Unable to resolve plate set for \"%s\" result (Row Id %d)", protocol.getName(), resultId));

PlateSetLineage lineage = getPlateSetLineage(container, user, plateSet.getRowId(), ContainerFilter.EVERYTHING_UNSAFE);
PlateSetLineage lineage = getPlateSetLineage(container, user, plateSet.getRowId(), ContainerFilter.getUnsafeEverythingFilter());
String plateSetPath = lineage.getSeedPath();

cache.put(plateId, Pair.of(plate.getContainer().getEntityId(), plateSetPath));
Expand Down Expand Up @@ -3342,7 +3342,7 @@ public PlateSetAssays getPlateSetAssays(Container container, User user, int plat
for (ExpProtocol protocol : protocols)
{
AssayProtocolSchema assayProtocolSchema = provider.createProtocolSchema(user, protocol.getContainer(), protocol, null);
TableInfo assayDataTable = assayProtocolSchema.createDataTable(ContainerFilter.EVERYTHING_UNSAFE, false);
TableInfo assayDataTable = assayProtocolSchema.createDataTable(ContainerFilter.getUnsafeEverythingFilter(), false);

if (assayDataTable != null)
{
Expand Down
2 changes: 1 addition & 1 deletion audit/src/org/labkey/audit/query/AuditLogUnionTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static class AuditUnionTable extends VirtualTable

public AuditUnionTable(@NotNull UserSchema schema, ContainerFilter cf)
{
super(AuditSchema.getInstance().getSchema(), AuditQuerySchema.AUDIT_TABLE_NAME, schema, ContainerFilter.EVERYTHING_UNSAFE);
super(AuditSchema.getInstance().getSchema(), AuditQuerySchema.AUDIT_TABLE_NAME, schema, ContainerFilter.getUnsafeEverythingFilter());

_query = new SQLFragment();
_query.appendComment("<AuditUnionTableInfo>", getSchema().getSqlDialect());
Expand Down
2 changes: 1 addition & 1 deletion core/src/org/labkey/core/query/CoreQuerySchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ private void toggleExpirationDateColumn(FilteredTable<UserSchema> users)
public TableInfo getPrincipals()
{
TableInfo principalsBase = CoreSchema.getInstance().getTableInfoPrincipals();
FilteredTable<CoreQuerySchema> principals = new FilteredTable<>(principalsBase, this, ContainerFilter.EVERYTHING_UNSAFE);
FilteredTable<CoreQuerySchema> principals = new FilteredTable<>(principalsBase, this, ContainerFilter.getUnsafeEverythingFilter());

//we expose userid, name and type via query
var col = principals.wrapColumn(principalsBase.getColumn("UserId"));
Expand Down
4 changes: 2 additions & 2 deletions experiment/src/org/labkey/experiment/ParentChildView.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ else if (!classId.equals(id))
QueryView queryView = new QueryView(schema, settings, null);
// Issue 38018: Sample Type: Multiple data inputs from different containers are not shown in the Parent Data grid
// Use ContainerFilter.EVERYTHING - We've already set an IN clause that restricts us to showing just data that we have permission to view
queryView.setContainerFilter(ContainerFilter.EVERYTHING_UNSAFE);
queryView.setContainerFilter(ContainerFilter.getUnsafeEverythingFilter());
TableInfo table = queryView.getTable();

CustomView v = queryView.getCustomView();
Expand Down Expand Up @@ -225,7 +225,7 @@ else if (!typeName.equals(type))
protected TableInfo createTable()
{
// Use ContainerFilter.EVERYTHING - We've already set an IN clause that restricts us to showing just data that we have permission to view
ExpMaterialTable table = ExperimentServiceImpl.get().createMaterialTable(getSchema(), ContainerFilter.EVERYTHING_UNSAFE, st);
ExpMaterialTable table = ExperimentServiceImpl.get().createMaterialTable(getSchema(), ContainerFilter.getUnsafeEverythingFilter(), st);
table.populate();

List<FieldKey> defaultVisibleColumns = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ UserSchema getUserSchema(String columns) throws Exception
TableInfo getUserTableInfo(String columns) throws Exception
{
UserSchema userSchema = getUserSchema(columns);
return userSchema.getTable("R", ContainerFilter.EVERYTHING_UNSAFE, true, false);
return userSchema.getTable("R", ContainerFilter.getUnsafeEverythingFilter(), true, false);
}


Expand Down
2 changes: 1 addition & 1 deletion query/src/org/labkey/query/sql/QValuesTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void setQueryRelation(QueryRelation queryRelation)
@Override
public ContainerFilter.Type getContainerFilterType()
{
return ContainerFilter.EVERYTHING_UNSAFE.getType();
return ContainerFilter.getUnsafeEverythingFilter().getType();
}

class _QueryRelation extends AbstractQueryRelation
Expand Down
2 changes: 1 addition & 1 deletion search/src/org/labkey/search/SearchModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void handle(Map<SearchStartupProperties, StartupPropertyEntry> properties
// Report the total number of search entries in the audit log
User user = new LimitedUser(User.getSearchUser(), CanSeeAuditLogRole.class);
UserSchema auditSchema = AuditLogService.get().createSchema(user, ContainerManager.getRoot());
TableInfo auditTable = auditSchema.getTableOrThrow(SearchAuditProvider.EVENT_TYPE, ContainerFilter.EVERYTHING_UNSAFE);
TableInfo auditTable = auditSchema.getTableOrThrow(SearchAuditProvider.EVENT_TYPE, ContainerFilter.getUnsafeEverythingFilter());

long count = new TableSelector(auditTable).getRowCount();
return Collections.singletonMap("fullTextSearches", count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ else if (COLUMN_NAME_SAMPLE_TYPE_ID.equalsIgnoreCase(col.getName()))
{
// lookup to SampleType by ID
col.setLabel("Sample Type ID");
col.setFk(QueryForeignKey.from(getUserSchema(), ContainerFilter.EVERYTHING_UNSAFE).schema(ExpSchema.SCHEMA_NAME).table(ExpSchema.TableType.SampleSets));
col.setFk(QueryForeignKey.from(getUserSchema(), ContainerFilter.getUnsafeEverythingFilter()).schema(ExpSchema.SCHEMA_NAME).table(ExpSchema.TableType.SampleSets));

// ExpSampleTypeTableImpl uses a details URL with the current Container as the URL's fixed
// container context, but we would like to use the audit event row's container column instead.
Expand Down
2 changes: 1 addition & 1 deletion study/src/org/labkey/study/query/AssayDatasetTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ private TableInfo getAssayResultTable()
}
AssayProtocolSchema schema = provider.createProtocolSchema(_userSchema.getUser(), protocol.getContainer(), protocol, getContainer());
schema.addContextualRole(RoleManager.getRole(ReaderRole.class));
_assayResultTable = schema.createDataTable(ContainerFilter.EVERYTHING_UNSAFE, false);
_assayResultTable = schema.createDataTable(ContainerFilter.getUnsafeEverythingFilter(), false);
schema.overlayMetadata(_assayResultTable, AssayProtocolSchema.DATA_TABLE_NAME);
}
return _assayResultTable;
Expand Down
4 changes: 2 additions & 2 deletions study/src/org/labkey/study/query/DatasetQueryView.java
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ else if (!timepointCol.isDateTimeType())
public SQLFragment getValidationSql(Container container, User user, ExpProtocol protocol, TableInfo dataTable)
{
var sqs = StudyQuerySchema.createSchema(_dataset.getStudy(), user, null);
TableInfo datasetTable = sqs.getDatasetTable(_dataset, ContainerFilter.EVERYTHING_UNSAFE);
TableInfo datasetTable = sqs.getDatasetTable(_dataset, ContainerFilter.getUnsafeEverythingFilter());

String studyVisit = _dataset.getStudy().getTimepointType().isVisitBased() ? "SequenceNum" : "Date";
if (datasetTable instanceof FilteredTable<?> filteredTable)
Expand All @@ -869,7 +869,7 @@ public SQLFragment getValidationSql(Container container, User user, ExpProtocol
@Override
public @Nullable ContainerFilter getContainerFilter()
{
return ContainerFilter.EVERYTHING_UNSAFE;
return ContainerFilter.getUnsafeEverythingFilter();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion study/src/org/labkey/study/query/SampleDatasetTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private TableInfo getSamplesTable()
// It is easier to handle these changes on the construction-side, so we use a helper schema
// CONSIDER: do we need a version of getTable() that allows passing custom options?
var noLinks = Objects.requireNonNull(samplesSchema.getSchema(SamplesSchema.STUDY_LINKED_SCHEMA_NAME));
_sampleTable = Objects.requireNonNull(noLinks.getTable(sampleType.getName(), ContainerFilter.EVERYTHING_UNSAFE));
_sampleTable = Objects.requireNonNull(noLinks.getTable(sampleType.getName(), ContainerFilter.getUnsafeEverythingFilter()));
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion study/src/org/labkey/study/query/VialTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public TableInfo getLookupTableInfo()
TableInfo tableInfo = schema.getTable(StudyQuerySchema.SIMPLE_SPECIMEN_TABLE_NAME);
if (tableInfo instanceof ContainerFilterable)
{
((ContainerFilterable) tableInfo).setContainerFilter(ContainerFilter.EVERYTHING_UNSAFE); // TODO: what would this do without provisioned?
((ContainerFilterable) tableInfo).setContainerFilter(ContainerFilter.getUnsafeEverythingFilter()); // TODO: what would this do without provisioned?
}
return tableInfo;
}
Expand Down