From c3c4a738865da334928eac485a3cab88a7262259 Mon Sep 17 00:00:00 2001 From: To-om Date: Mon, 29 Jun 2020 16:48:28 +0200 Subject: [PATCH] #1410 Add link to organisation (get API) --- .../controllers/v1/OrganisationCtrl.scala | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/thehive/app/org/thp/thehive/controllers/v1/OrganisationCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/OrganisationCtrl.scala index 46bbeebf6f..74721aafbf 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/OrganisationCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/OrganisationCtrl.scala @@ -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)) }