Skip to content

Commit

Permalink
#1410 Add link to organisation (get API)
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jun 29, 2020
1 parent a2e50d0 commit c3c4a73
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions thehive/app/org/thp/thehive/controllers/v1/OrganisationCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ class OrganisationCtrl @Inject() (
def get(organisationId: String): Action[AnyContent] =
entrypoint("get organisation")
.authRoTransaction(db) { implicit request => implicit graph =>
userSrv
.current
.organisations
.visibleOrganisationsFrom
.get(organisationId)
.getOrFail()
(if (request.organisation == "admin")
organisationSrv.get(organisationId)
else
userSrv
.current
.organisations
.visibleOrganisationsFrom
.get(organisationId))
.richOrganisation
.getOrFail("Organisation")
.map(organisation => Results.Ok(organisation.toJson))
}

Expand Down

0 comments on commit c3c4a73

Please sign in to comment.