From 17c5da216ff762ffb49984cafdf7911f5d5b4a88 Mon Sep 17 00:00:00 2001 From: toddn Date: Fri, 23 Aug 2024 13:58:19 -0500 Subject: [PATCH 1/5] adding creator to the space json returned --- app/api/Spaces.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/app/api/Spaces.scala b/app/api/Spaces.scala index e48de645b..e268e665e 100644 --- a/app/api/Spaces.scala +++ b/app/api/Spaces.scala @@ -167,6 +167,7 @@ class Spaces @Inject()(spaces: SpaceService, toJson(Map("id" -> space.id.stringify, "name" -> space.name, "description" -> space.description, + "creator" -> space.creator.stringify, "created" -> space.created.toString)) } From 4d61de08a35cb3130590f58f9d1d34bb71194807 Mon Sep 17 00:00:00 2001 From: toddn Date: Fri, 23 Aug 2024 15:10:01 -0500 Subject: [PATCH 2/5] adding new route for getting users in space --- app/api/Spaces.scala | 19 +++++++++++++++++++ conf/routes | 1 + 2 files changed, 20 insertions(+) diff --git a/app/api/Spaces.scala b/app/api/Spaces.scala index e268e665e..afe976b85 100644 --- a/app/api/Spaces.scala +++ b/app/api/Spaces.scala @@ -90,6 +90,18 @@ class Spaces @Inject()(spaces: SpaceService, case None => NotFound("Space not found") } } + def getUsers(id: UUID) = PermissionAction(Permission.ViewSpace, Some(ResourceRef(ResourceRef.space, id))) { implicit request => + spaces.get(id) match { + case Some(space) => + + val usersInSpace = spaces.getUsersInSpace(space.id, None) + + Ok(toJson(usersInSpace.map(userToJson))) + case None => { + NotFound("Space not found") + } + } + } def list(when: Option[String], title: Option[String], date: Option[String], limit: Int) = UserAction(needActive=false) { implicit request => Ok(toJson(listSpaces(when, title, date, limit, Set[Permission](Permission.ViewSpace), false, request.user, request.user.fold(false)(_.superAdminMode), true).map(spaceToJson))) @@ -171,6 +183,13 @@ class Spaces @Inject()(spaces: SpaceService, "created" -> space.created.toString)) } + def userToJson(user: User) = { + toJson(Map("id" -> user.id.stringify, + "email" -> user.email.get + )) + } + + def addCollectionToSpace(spaceId: UUID, collectionId: UUID) = PermissionAction(Permission.AddResourceToSpace, Some(ResourceRef(ResourceRef.space, spaceId))) { implicit request => (spaces.get(spaceId), collectionService.get(collectionId)) match { diff --git a/conf/routes b/conf/routes index 786757f97..916f716ba 100644 --- a/conf/routes +++ b/conf/routes @@ -488,6 +488,7 @@ GET /api/files/:three_d_file_id/:filename GET /api/spaces @api.Spaces.list(when: Option[String] ?= None, title: Option[String] ?= None, date: Option[String] ?= None, limit: Int ?= 12) GET /api/spaces/canEdit @api.Spaces.listCanEdit(when: Option[String] ?= None, title: Option[String] ?= None, date: Option[String] ?= None, limit: Int ?= 12) GET /api/spaces/:id @api.Spaces.get(id: UUID) +GET /api/spaces/:id/users @api.Spaces.getUsers(id: UUID) POST /api/spaces @api.Spaces.createSpace() DELETE /api/spaces/:id @api.Spaces.removeSpace(id: UUID) POST /api/spaces/:spaceId/removeCollection/:collectionId @api.Spaces.removeCollection(spaceId: UUID, collectionId: UUID, removeDatasets : Boolean) From 334e3dd5df2ca1ea344da8acb55e5895e4f7dfdc Mon Sep 17 00:00:00 2001 From: toddn Date: Fri, 23 Aug 2024 15:10:34 -0500 Subject: [PATCH 3/5] cleaning up spaces --- app/api/Spaces.scala | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/api/Spaces.scala b/app/api/Spaces.scala index afe976b85..119655667 100644 --- a/app/api/Spaces.scala +++ b/app/api/Spaces.scala @@ -93,9 +93,7 @@ class Spaces @Inject()(spaces: SpaceService, def getUsers(id: UUID) = PermissionAction(Permission.ViewSpace, Some(ResourceRef(ResourceRef.space, id))) { implicit request => spaces.get(id) match { case Some(space) => - val usersInSpace = spaces.getUsersInSpace(space.id, None) - Ok(toJson(usersInSpace.map(userToJson))) case None => { NotFound("Space not found") From 998cd3aa9a55c77738aa9bbf169e4c3a1b0c796c Mon Sep 17 00:00:00 2001 From: toddn Date: Wed, 10 Sep 2025 12:24:12 -0500 Subject: [PATCH 4/5] adding changelog entry --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37eb95678..2f2f4fddf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 1.22.2 - 2025-09-10 + +### Added +- Space api routes now return users and creator. + ## 1.22.1 - 2023-11-10 ### Fixed From cdb468bced8a1321536dd0ac46f8174e4bbe8e9a Mon Sep 17 00:00:00 2001 From: Luigi Marini Date: Tue, 16 Sep 2025 15:37:07 -0500 Subject: [PATCH 5/5] Moved changelog entry to Unreleased. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f2f4fddf..c59910c6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## 1.22.2 - 2025-09-10 +## [Unreleased] ### Added - Space api routes now return users and creator.