Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow handling dataset configurations for datasets not normally visible #5047

Merged
merged 1 commit into from
Jan 14, 2021
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
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
### Fixed
- Fixed a bug where importing NMLs failed if they had unescaped greater-than signs inside of attributes. [#5003](https://github.com/scalableminds/webknossos/pull/5003)
- Mitigate errors concerning localStorage quotas in the datasets dashboard. [#5039](https://github.com/scalableminds/webknossos/pull/5039)
- Fixed a bug where viewing a dataset via sharingToken crashed. [#5047](https://github.com/scalableminds/webknossos/pull/5047)

### Removed
-
11 changes: 7 additions & 4 deletions app/controllers/ConfigurationController.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package controllers

import com.mohiva.play.silhouette.api.Silhouette
import com.scalableminds.util.accesscontext.GlobalAccessContext
import models.binary.{DataSetDAO, DataSetService}
import models.configuration.{DataSetConfigurationService, UserConfiguration}
import models.user.UserService
Expand All @@ -9,8 +10,8 @@ import play.api.i18n.Messages
import play.api.libs.json.JsObject
import play.api.libs.json.Json._
import play.api.mvc.PlayBodyParsers

import javax.inject.Inject

import scala.concurrent.ExecutionContext

class ConfigurationController @Inject()(
Expand Down Expand Up @@ -42,9 +43,11 @@ class ConfigurationController @Inject()(
def readDataSetViewConfiguration(organizationName: String, dataSetName: String) =
sil.UserAwareAction.async(validateJson[List[String]]) { implicit request =>
request.identity.toFox
.flatMap(user =>
dataSetConfigurationService
.getDataSetViewConfigurationForUserAndDataset(request.body, user, dataSetName, organizationName))
.flatMap(
user =>
dataSetConfigurationService
.getDataSetViewConfigurationForUserAndDataset(request.body, user, dataSetName, organizationName)(
GlobalAccessContext))
.orElse(
dataSetConfigurationService.getDataSetViewConfigurationForDataset(request.body, dataSetName, organizationName)
)
Expand Down
2 changes: 1 addition & 1 deletion app/models/configuration/DataSetConfigurationService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import com.scalableminds.util.tools.Fox
import com.scalableminds.webknossos.datastore.models.datasource.DataLayerLike
import com.scalableminds.webknossos.datastore.models.datasource.DataSetViewConfiguration.DataSetViewConfiguration
import com.scalableminds.webknossos.datastore.models.datasource.LayerViewConfiguration.LayerViewConfiguration
import javax.inject.Inject
import models.binary.{DataSet, DataSetDAO, DataSetDataLayerDAO, DataSetService}
import models.user.{User, UserDataSetConfigurationDAO, UserDataSetLayerConfigurationDAO}
import play.api.libs.json._

import javax.inject.Inject
import scala.concurrent.ExecutionContext

class DataSetConfigurationService @Inject()(dataSetService: DataSetService,
Expand Down
2 changes: 1 addition & 1 deletion app/models/user/UserService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class UserService @Inject()(conf: WkConf,
dataSetConfiguration: DataSetViewConfiguration,
layerConfiguration: Option[JsValue])(implicit ctx: DBAccessContext, m: MessagesProvider): Fox[Unit] =
for {
dataSet <- dataSetDAO.findOneByNameAndOrganizationName(dataSetName, organizationName) ?~> Messages(
dataSet <- dataSetDAO.findOneByNameAndOrganizationName(dataSetName, organizationName)(GlobalAccessContext) ?~> Messages(
"dataSet.notFound",
dataSetName)
layerMap = layerConfiguration.flatMap(_.asOpt[Map[String, JsValue]]).getOrElse(Map.empty)
Expand Down