@Override
  public boolean isScanAllowedUsingPermissionsFromDevopsPlatform() {
    checkState(authAppInstallationToken != null, "An auth app token is required in case repository permissions checking is necessary.");

    String[] orgaAndRepoTokenified = devOpsProjectCreationContext.fullName().split("/");
    String organization = orgaAndRepoTokenified[0];
    String repository = orgaAndRepoTokenified[1];

    Set<DevOpsPermissionsMappingDto> permissionsMappingDtos = dbClient.githubPermissionsMappingDao()
      .findAll(dbClient.openSession(false), devOpsPlatformSettings.getDevOpsPlatform());

    boolean userHasDirectAccessToRepo = doesUserHaveScanPermission(organization, repository, permissionsMappingDtos);
    if (userHasDirectAccessToRepo) {
      return true;
    }
    return doesUserBelongToAGroupWithScanPermission(organization, repository, permissionsMappingDtos);
  }
@Test
  void isScanAllowedUsingPermissionsFromDevopsPlatform_whenAccessViaTeam_returnsTrue() {
    GsonRepositoryTeam team1 = mockGithubTeam("team1", 1, "role1", "read", "another_perm");
    GsonRepositoryTeam team2 = mockGithubTeam("team2", 2, "role2", "another_perm", UserRole.SCAN);
    mockTeamsFromApi(team1, team2);
    bindGroupsToUser(team1.name(), team2.name());

    assertThat(githubProjectCreator.isScanAllowedUsingPermissionsFromDevopsPlatform()).isTrue();
  }