@@ -248,6 +248,19 @@ private Mono<Void> checkApplicationStatus(Application application, ApplicationSt
248
248
return Mono .error (new BizException (BizError .UNSUPPORTED_OPERATION , "BAD_REQUEST" ));
249
249
}
250
250
251
+ private Mono <Void > checkApplicationViewRequest (Application application , ApplicationEndpoints .ApplicationRequestType expected ) {
252
+ if (expected == ApplicationEndpoints .ApplicationRequestType .PUBLIC_TO_ALL && application .isPublicToAll ()) {
253
+ return Mono .empty ();
254
+ }
255
+ if (expected == ApplicationEndpoints .ApplicationRequestType .PUBLIC_TO_MARKETPLACE && application .isPublicToMarketplace ()) {
256
+ return Mono .empty ();
257
+ }
258
+ if (expected == ApplicationEndpoints .ApplicationRequestType .AGENCY_PROFILE && application .agencyProfile ()) {
259
+ return Mono .empty ();
260
+ }
261
+ return Mono .error (new BizException (BizError .UNSUPPORTED_OPERATION , "BAD_REQUEST" ));
262
+ }
263
+
251
264
private Mono <Boolean > updateApplicationStatus (String applicationId , ApplicationStatus applicationStatus ) {
252
265
return checkCurrentUserApplicationPermission (applicationId , MANAGE_APPLICATIONS )
253
266
.then (Mono .defer (() -> {
@@ -280,10 +293,11 @@ public Mono<ApplicationView> getEditingApplication(String applicationId) {
280
293
});
281
294
}
282
295
283
- public Mono <ApplicationView > getPublishedApplication (String applicationId ) {
296
+ public Mono <ApplicationView > getPublishedApplication (String applicationId , ApplicationEndpoints . ApplicationRequestType requestType ) {
284
297
return checkPermissionWithReadableErrorMsg (applicationId , READ_APPLICATIONS )
285
298
.zipWhen (permission -> applicationService .findById (applicationId )
286
- .delayUntil (application -> checkApplicationStatus (application , NORMAL )))
299
+ .delayUntil (application -> checkApplicationStatus (application , NORMAL ))
300
+ .delayUntil (application -> checkApplicationViewRequest (application , requestType )))
287
301
.zipWhen (tuple -> applicationService .getAllDependentModulesFromApplication (tuple .getT2 (), true ), TupleUtils ::merge )
288
302
.zipWhen (tuple -> organizationService .getOrgCommonSettings (tuple .getT2 ().getOrganizationId ()), TupleUtils ::merge )
289
303
.zipWith (getTemplateIdFromApplicationId (applicationId ), TupleUtils ::merge )
0 commit comments