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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed
- Clowder will no longer offer a Download button for a file until it has been PROCESSED.
- When space created through api the creator was not added to space as admin [#179](https://github.com/clowder-framework/clowder/issues/179).

### Changed
- `/api/me` will now return some of the same information as response headers.
Expand Down
24 changes: 13 additions & 11 deletions app/api/Spaces.scala
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
package api

import java.util.Date
import javax.inject.Inject
import api.Permission.Permission
import controllers.Utils
import models._
import play.api.Logger
import controllers.Utils
import play.api.Play._
import play.api.libs.json.Json
import play.api.libs.json.Json._
import play.api.libs.json.Json.toJson
import play.api.i18n.Messages
import play.api.libs.json.{JsError, JsResult, JsSuccess, Json}
import play.api.libs.json.Json.{toJson, _}
import services._
import util.Mail
import play.api.libs.json.JsResult
import play.api.libs.json.JsSuccess
import play.api.libs.json.JsError
import play.api.i18n.Messages

import scala.util.Try
import java.util.Date
import javax.inject.Inject

/**
* Spaces allow users to partition the data into realms only accessible to users with the right permissions.
Expand Down Expand Up @@ -51,6 +46,13 @@ class Spaces @Inject()(spaces: SpaceService,
case Some(id) => {
appConfig.incrementCount('spaces, 1)
events.addObjectEvent(request.user, c.id, c.name, "create_space")
userService.findRoleByName("Admin") match {
case Some(realRole) => {
spaces.addUser(userId, realRole, UUID(id))
}
case None => Logger.info("No admin role found")

}
Ok(toJson(Map("id" -> id)))
}
case None => Ok(toJson(Map("status" -> "error")))
Expand Down