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 @@ -1599,8 +1599,8 @@ else if (!form.isIgnore())
{
exceptionStackTrace.setBugNumber(-1);
}
MothershipManager.get().updateExceptionStackTrace(exceptionStackTrace, getUser());
}
MothershipManager.get().updateExceptionStackTrace(exceptionStackTrace, getUser());
}
catch (NumberFormatException e)
{
Expand Down
14 changes: 14 additions & 0 deletions mothership/src/org/labkey/mothership/MothershipManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.labkey.api.util.MothershipReport;
import org.labkey.api.util.ReentrantLockWithName;
import org.labkey.api.util.logging.LogHelper;
import org.labkey.api.view.NotFoundException;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -211,6 +212,13 @@ public SoftwareRelease ensureSoftwareRelease(Container container, String revisio
}
}

public SoftwareRelease getSoftwareRelease(int softwareReleaseId, Container container)
{
SimpleFilter filter = SimpleFilter.createContainerFilter(container);
filter.addCondition(FieldKey.fromString("SoftwareReleaseId"), softwareReleaseId);
return new TableSelector(getTableInfoSoftwareRelease(), filter, null).getObject(SoftwareRelease.class);
}

public ServerInstallation getServerInstallation(@NotNull String serverGUID, @NotNull String serverHostName, @NotNull Container c)
{
SimpleFilter filter = SimpleFilter.createContainerFilter(c);
Expand Down Expand Up @@ -604,6 +612,12 @@ public void setStatusCakeApiKey(String statusCakeApiKey)

public void updateSoftwareRelease(Container container, User user, SoftwareRelease bean)
{
// Verify the target row actually belongs to this container before updating. The raw Table.update below is
// keyed only on the primary key, so without this check a user with UpdatePermission in one folder could edit
// (and, via setContainer, re-home) a SoftwareRelease owned by another folder.
if (getSoftwareRelease(bean.getSoftwareReleaseId(), container) == null)
throw new NotFoundException("SoftwareRelease not found in this folder: " + bean.getSoftwareReleaseId());

bean.setContainer(container.getId());
Table.update(user, getTableInfoSoftwareRelease(), bean, bean.getSoftwareReleaseId());
}
Expand Down