diff --git a/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/JobCtrl.scala b/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/JobCtrl.scala index dc1a7d6a8b..1aa7df543c 100644 --- a/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/JobCtrl.scala +++ b/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/JobCtrl.scala @@ -58,7 +58,7 @@ class JobCtrl @Inject() ( db.roTransaction { implicit graph => val artifactId: String = request.body("artifactId") for { - o <- observableSrv.get(EntityIdOrName(artifactId)).richObservable.getOrFail("Observable") + o <- observableSrv.get(EntityIdOrName(artifactId)).can(Permissions.manageAnalyse).richObservable.getOrFail("Observable") c <- observableSrv.get(EntityIdOrName(artifactId)).`case`.getOrFail("Case") } yield (o, c) }.fold( diff --git a/thehive/app/org/thp/thehive/services/UserSrv.scala b/thehive/app/org/thp/thehive/services/UserSrv.scala index b92e077de9..0e324fa4d4 100644 --- a/thehive/app/org/thp/thehive/services/UserSrv.scala +++ b/thehive/app/org/thp/thehive/services/UserSrv.scala @@ -353,6 +353,7 @@ class UserIntegrityCheck @Inject() ( (_.out("UserRole"), _.in("UserRole")), (_.out("RoleOrganisation"), _.in("RoleOrganisation")) ).flatMap(ElementSelector.firstCreatedElement(_)).map(e => removeVertices(e._2)).size - Map("duplicateRoleLinks" -> duplicateRoleLinks.toLong) + val orphanCount = service.startTraversal.filterNot(_.organisations).sideEffect(_.drop()).getCount + Map("duplicateRoleLinks" -> duplicateRoleLinks.toLong, "orphan" -> orphanCount) } }