Skip to content

Commit

Permalink
maybe we can just create the principal
Browse files Browse the repository at this point in the history
  • Loading branch information
UnsungHero97 committed Feb 16, 2022
1 parent 389fb5f commit be52dea
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.openlattice.mechanic.upgrades
import com.geekbeast.rhizome.configuration.RhizomeConfiguration
import com.hazelcast.query.Predicates
import com.openlattice.authorization.AclKey
import com.openlattice.authorization.Principal
import com.openlattice.authorization.PrincipalType
import com.openlattice.authorization.Principals
import com.openlattice.data.storage.MetadataOption
import com.openlattice.data.storage.postgres.PostgresEntityDataQueryService
Expand Down Expand Up @@ -193,16 +195,13 @@ class V3StudyMigrationUpgrade(

private fun processParticipantsOfStudy(conn: Connection, orgId: UUID, studyEkid: UUID, orgStudyEntitySetIds: Set<UUID>, orgMaybeParticipantEntitySetIds: Set<UUID>) {

val chronicleSuperUserPrincipals = Principals.getUserPrincipals("")
logger.info("Using chronicle super user principals $chronicleSuperUserPrincipals to execute neighbour search")

val filter = EntityNeighborsFilter(setOf(studyEkid), Optional.of(orgMaybeParticipantEntitySetIds), Optional.of(orgStudyEntitySetIds), Optional.empty())

// get all participants for the study
val searchResult = searchService.executeEntityNeighborSearch(
orgStudyEntitySetIds,
PagedNeighborRequest(filter),
chronicleSuperUserPrincipals
setOf(Principal(PrincipalType.USER, ""))
).neighbors.getOrDefault(studyEkid, listOf())

if (searchResult.isNotEmpty()) {
Expand Down

0 comments on commit be52dea

Please sign in to comment.