Skip to content

Commit

Permalink
cleaned up and updated the REST doc
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandunn committed Oct 30, 2019
1 parent 4d55b01 commit 9826657
Show file tree
Hide file tree
Showing 2 changed files with 1,040 additions and 1,036 deletions.
Expand Up @@ -50,15 +50,14 @@ class OrganismController {
@RestApiParams(params = [
@RestApiParam(name = "username", type = "email", paramType = RestApiParamType.QUERY)
, @RestApiParam(name = "password", type = "password", paramType = RestApiParamType.QUERY)
, @RestApiParam(name = "id", type = "string", paramType = RestApiParamType.QUERY, description = "Pass an Organism database `id` or `commonName` that corresponds to the organism to be removed")
, @RestApiParam(name = "id", type = "string or number", paramType = RestApiParamType.QUERY, description = "Pass an Organism ID or commonName that corresponds to the organism to be removed")
])
@Transactional
def deleteOrganism() {

try {
JSONObject organismJson = permissionService.handleInput(request, params)
log.debug "deleteOrganism ${organismJson}"
//if (permissionService.isUserBetterOrEqualRank(currentUser, GlobalPermissionEnum.INSTRUCTOR)){
log.debug "organism ID: ${organismJson.id}"
// backporting a bug here:
Organism organism = Organism.findByCommonName(organismJson.id as String)
Expand Down Expand Up @@ -123,13 +122,10 @@ class OrganismController {

try {
//if (permissionService.isUserGlobalAdmin(permissionService.getCurrentUser(requestObject))) {
// use hasGolbalPermssions instead, which can validate the authentication
if (permissionService.hasGlobalPermissions(requestObject, GlobalPermissionEnum.ADMIN)) {
Organism organism = preferenceService.getOrganismForTokenInDB(requestObject.organism as String)
println "found organism to remove ${organism} from ${requestObject.organism}"
if(!organism){
organism = preferenceService.getOrganismForTokenInDB(requestObject.id as String)
println "found organism to remove ${organism} from ${requestObject.id}"
}
if (organism) {
boolean dataAddedViaWebServices = organism.dataAddedViaWebServices == null ? false : organism.dataAddedViaWebServices
Expand Down Expand Up @@ -374,7 +370,6 @@ class OrganismController {
assert searchDirectory.mkdir()
assert searchDirectory.setWritable(true)
File searchFile = new File(searchDirectory.absolutePath + File.separator + searchDatabaseDataFile.originalFilename)
println "search file: ${searchFile.absolutePath}"
searchDatabaseDataFile.transferTo(searchFile)
organism.blatdb = searchFile.absolutePath
}
Expand Down

0 comments on commit 9826657

Please sign in to comment.