From dbed42daf2b268b187e76ff302657b92a2295a88 Mon Sep 17 00:00:00 2001 From: To-om Date: Sun, 28 Jun 2020 20:06:54 +0200 Subject: [PATCH] #1395 Refuse link with admin organisation --- .../app/org/thp/thehive/services/OrganisationSrv.scala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/thehive/app/org/thp/thehive/services/OrganisationSrv.scala b/thehive/app/org/thp/thehive/services/OrganisationSrv.scala index f1a7049153..df057ae488 100644 --- a/thehive/app/org/thp/thehive/services/OrganisationSrv.scala +++ b/thehive/app/org/thp/thehive/services/OrganisationSrv.scala @@ -81,10 +81,12 @@ class OrganisationSrv @Inject() ( else organisationOrganisationSrv.create(OrganisationOrganisation(), fromOrg, toOrg).map(_ => ()) def doubleLink(org1: Organisation with Entity, org2: Organisation with Entity)(implicit authContext: AuthContext, graph: Graph): Try[Unit] = - for { - _ <- link(org1, org2) - _ <- link(org2, org1) - } yield () + if (org1.name == "admin" || org2.name == "admin") Failure(BadRequestError("Admin organisation cannot be link with other organisation")) + else + for { + _ <- link(org1, org2) + _ <- link(org2, org1) + } yield () def unlink(fromOrg: Organisation with Entity, toOrg: Organisation with Entity)(implicit graph: Graph): Try[Unit] = Success(