Skip to content

Commit

Permalink
#1395 Refuse link with admin organisation
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jun 28, 2020
1 parent 0070538 commit dbed42d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions thehive/app/org/thp/thehive/services/OrganisationSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit dbed42d

Please sign in to comment.