Skip to content

Commit

Permalink
Require authN for routes in DataController.scala (#1014)
Browse files Browse the repository at this point in the history
Require users to be authenticated when using these endpoints:

- /api/v2/data/challenge/:challengeId
- /api/v2/data/challenge/:challengeId/propertyKeys
- /api/v2/data/challenge/summary
- /api/v2/data/project/summary
  • Loading branch information
ljdelight authored Jan 22, 2023
1 parent 285fa5c commit 4a12c1e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/org/maproulette/controllers/api/DataController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class DataController @Inject() (
priority: String,
includeByPriority: Boolean = false
): Action[AnyContent] = Action.async { implicit request =>
this.sessionManager.userAwareRequest { implicit user =>
this.sessionManager.authenticatedRequest { _ =>
SearchParameters.withSearch { implicit params =>
val response = this.dataManager.getChallengeSummary(
challengeId = Some(id),
Expand Down Expand Up @@ -185,7 +185,7 @@ class DataController @Inject() (
onlyEnabled: Boolean = true,
includeByPriority: Boolean = false
): Action[AnyContent] = Action.async { implicit request =>
this.sessionManager.userAwareRequest { implicit user =>
this.sessionManager.authenticatedRequest { _ =>
val response =
this.dataManager.getChallengeSummary(Utils.toLongList(projects), onlyEnabled = onlyEnabled)

Expand Down Expand Up @@ -260,7 +260,7 @@ class DataController @Inject() (
priority: String,
onlyEnabled: Boolean = true
): Action[AnyContent] = Action.async { implicit request =>
this.sessionManager.userAwareRequest { implicit user =>
this.sessionManager.authenticatedRequest { _ =>
val postData = request.body.asInstanceOf[AnyContentAsFormUrlEncoded].data
val draw = postData.get("draw").head.head.toInt
val start = postData.get("start").head.head.toInt
Expand Down Expand Up @@ -434,7 +434,7 @@ class DataController @Inject() (
}

def getPropertyKeys(challengeId: Long): Action[AnyContent] = Action.async { implicit request =>
this.sessionManager.userAwareRequest { implicit user =>
this.sessionManager.authenticatedRequest { _ =>
Ok(Json.toJson(Map("keys" -> dataManager.getPropertyKeys(challengeId))))
}
}
Expand Down

0 comments on commit 4a12c1e

Please sign in to comment.