@@ -204,10 +204,64 @@ public Mono<Boolean> setApplicationAsAgencyProfile(String applicationId, boolean
204
204
return mongoUpsertHelper .updateById (application , applicationId );
205
205
}
206
206
207
+ // getPublicApplicationIds /view - publicToAll check
208
+ // getPublicMarketplaceApplicationIds / marketplace_view - publicToAll and publicToMarketplace check & isPrivateMarketplace check
209
+ // getPublicAgencyProfileApplicationIds / agency_profile_view - publicToAll and agencyProfile check
210
+
211
+ // marketplace_view [anonymous] publicToAll and publicToMarketplace check & isPrivateMarketplace false -> OK
212
+
213
+ // marketplace_view [anonymous] publicToAll and publicToMarketplace check & isPrivateMarketplace true -> NOT OK
214
+
215
+ // marketplace_view [LoggedIn] publicToAll and publicToMarketplace check & isPrivateMarketplace true -> OK
216
+ // marketplace_view [LoggedIn] publicToAll and publicToMarketplace check & isPrivateMarketplace false -> OK
217
+
218
+
219
+ // will be extended by EndpointType
220
+ /*
221
+ * if (EndpointType == view)
222
+ * if (EndpointType == marketplace_view)
223
+ * if (EndpointType == agency_profile_view)
224
+ */
225
+
226
+ // is it needed?
207
227
@ NonEmptyMono
208
228
@ SuppressWarnings ("ReactiveStreamsNullableInLambdaInTransform" )
209
229
public Mono <Set <String >> getPublicApplicationIds (Collection <String > applicationIds , Boolean isAnonymous , Boolean isPrivateMarketplace ) {
210
230
231
+ return repository .findByPublicToAllIsTrue ()
232
+ .map (HasIdAndAuditing ::getId )
233
+ .collect (Collectors .toSet ());
234
+ }
235
+
236
+ // for Marketplaces
237
+ @ NonEmptyMono
238
+ @ SuppressWarnings ("ReactiveStreamsNullableInLambdaInTransform" )
239
+ public Mono <Set <String >> getPublicMarketplaceApplicationIds (Collection <String > applicationIds , Boolean isAnonymous , Boolean isPrivateMarketplace ) {
240
+
241
+ if (isAnonymous ) {
242
+ if (isPrivateMarketplace ) {
243
+ return repository .findByPublicToAllIsTrueAndPublicToMarketplaceIsTrue (false , false , applicationIds )
244
+ .map (HasIdAndAuditing ::getId )
245
+ .collect (Collectors .toSet ());
246
+ } else {
247
+ return repository .findByPublicToAllIsTrueAndPublicToMarketplaceIsTrue (true , false , applicationIds )
248
+ .map (HasIdAndAuditing ::getId )
249
+ .collect (Collectors .toSet ());
250
+ }
251
+ } else {
252
+ return repository .findByPublicToAllIsTrueAndPublicToMarketplaceIsTrue (true , true , applicationIds )
253
+ .map (HasIdAndAuditing ::getId )
254
+ .collect (Collectors .toSet ());
255
+ }
256
+
257
+
258
+ }
259
+
260
+ // for Agencies
261
+ @ NonEmptyMono
262
+ @ SuppressWarnings ("ReactiveStreamsNullableInLambdaInTransform" )
263
+ public Mono <Set <String >> getPublicAgencyApplicationIds (Collection <String > applicationIds , Boolean isAnonymous , Boolean isPrivateMarketplace ) {
264
+
211
265
if (isAnonymous ) {
212
266
if (isPrivateMarketplace ) {
213
267
return repository .findByPublicToAllIsTrueAndPublicToMarketplaceIsAndAgencyProfileIsAndIdIn (false , false , applicationIds )
0 commit comments