Skip to content

Commit

Permalink
ID-1023 Fix list resources v2 endpoint bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-in-a-Jar committed Jan 26, 2024
1 parent 802eb68 commit 56a69a0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package org.broadinstitute.dsde.workbench.sam.model.api

trait FilteredResources {
def format: String
val format: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ package org.broadinstitute.dsde.workbench.sam.model.api

import org.broadinstitute.dsde.workbench.model.WorkbenchGroupName
import org.broadinstitute.dsde.workbench.sam.model.{AccessPolicyName, ResourceAction, ResourceId, ResourceRoleName, ResourceTypeName}
import spray.json.DefaultJsonProtocol.jsonFormat1
import spray.json.DefaultJsonProtocol.jsonFormat2
import spray.json.RootJsonFormat
import org.broadinstitute.dsde.workbench.sam.model.api.SamJsonSupport._
import org.broadinstitute.dsde.workbench.model.WorkbenchIdentityJsonSupport._
import spray.json.DefaultJsonProtocol._

object FilteredResourcesFlat {
implicit val FilteredResourcesFlatFormat: RootJsonFormat[FilteredResourcesFlat] = jsonFormat1(FilteredResourcesFlat.apply)
implicit val FilteredResourcesFlatFormat: RootJsonFormat[FilteredResourcesFlat] = jsonFormat2(FilteredResourcesFlat.apply)

}
case class FilteredResourcesFlat(resources: Set[FilteredResourceFlat]) extends FilteredResources {
override def format: String = "flat"
}
case class FilteredResourcesFlat(resources: Set[FilteredResourceFlat], format: String = "flat") extends FilteredResources

object FilteredResourceFlat {
implicit val FilteredResourceFlatFormat: RootJsonFormat[FilteredResourceFlat] = jsonFormat7(FilteredResourceFlat.apply)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import spray.json.RootJsonFormat
import org.broadinstitute.dsde.workbench.model.WorkbenchIdentityJsonSupport._

object FilteredResourcesHierarchical {
implicit val FilteredResourcesHierarchicalFormat: RootJsonFormat[FilteredResourcesHierarchical] = jsonFormat1(FilteredResourcesHierarchical.apply)
implicit val FilteredResourcesHierarchicalFormat: RootJsonFormat[FilteredResourcesHierarchical] = jsonFormat2(FilteredResourcesHierarchical.apply)

}
case class FilteredResourcesHierarchical(resources: Set[FilteredResourceHierarchical]) extends FilteredResources {
override def format: String = "hierarchical"
}
case class FilteredResourcesHierarchical(resources: Set[FilteredResourceHierarchical], format: String = "hierarchical") extends FilteredResources

case object FilteredResourceHierarchicalPolicy {
implicit val filteredResourceHierarchicalPolicyFormat: RootJsonFormat[FilteredResourceHierarchicalPolicy] = jsonFormat5(
FilteredResourceHierarchicalPolicy.apply
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class StandardSamUserDirectivesSpec extends AnyFlatSpec with PropertyBasedTestin
Get("/").withHeaders(headers) ~>
handleExceptions(myExceptionHandler)(services.withActiveUser(samRequestContext)(_ => complete(""))) ~> check {
status shouldBe StatusCodes.Unauthorized
responseAs[String] should include("sam.testUrl.mock")
responseAs[String] should include("terms of service")
}
}

Expand Down

0 comments on commit 56a69a0

Please sign in to comment.