Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd4ea385

Browse files
committed
Handle marketplace-apps api handling for public marketplace
1 parent060851e commitd4ea385

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

‎server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/application/ApplicationController.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
importorg.lowcoder.api.application.view.ApplicationView;
1818
importorg.lowcoder.api.application.view.MarketplaceApplicationInfoView;
1919
importorg.lowcoder.api.framework.view.ResponseView;
20+
importorg.lowcoder.api.home.SessionUserService;
2021
importorg.lowcoder.api.home.UserHomeApiService;
2122
importorg.lowcoder.api.home.UserHomepageView;
2223
importorg.lowcoder.api.util.BusinessEventPublisher;
@@ -39,6 +40,7 @@ public class ApplicationController implements ApplicationEndpoints {
3940
privatefinalUserHomeApiServiceuserHomeApiService;
4041
privatefinalApplicationApiServiceapplicationApiService;
4142
privatefinalBusinessEventPublisherbusinessEventPublisher;
43+
privatefinalSessionUserServicesessionUserService;
4244

4345
@Override
4446
publicMono<ResponseView<ApplicationView>>create(@RequestBodyCreateApplicationRequestcreateApplicationRequest) {

‎server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/framework/security/SecurityConfig.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
109109
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,CONFIG_URL +"/deploymentId"),// system config
110110
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,APPLICATION_URL +"/*/view"),// application view
111111
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,APPLICATION_URL +"/*/view_marketplace"),// application view
112+
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,APPLICATION_URL +"/marketplace-apps"),// marketplace apps
113+
112114
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,USER_URL +"/me"),
113115
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,USER_URL +"/currentUser"),
114116

@@ -134,6 +136,7 @@ SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
134136
ServerWebExchangeMatchers.pathMatchers(HttpMethod.HEAD,NewUrl.STATE_URL +"/healthCheck"),
135137
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,NewUrl.APPLICATION_URL +"/*/view"),
136138
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,NewUrl.APPLICATION_URL +"/*/view_marketplace"),
139+
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,NewUrl.APPLICATION_URL +"/marketplace-apps"),// marketplace apps
137140
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,NewUrl.USER_URL +"/me"),
138141
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,NewUrl.USER_URL +"/currentUser"),
139142
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,NewUrl.GROUP_URL +"/list"),
@@ -180,6 +183,7 @@ private CorsConfigurationSource buildCorsConfigurationSource() {
180183
source.registerCorsConfiguration(QUERY_URL +"/execute",skipCheckCorsForAll);
181184
source.registerCorsConfiguration(APPLICATION_URL +"/*/view",skipCheckCorsForAll);
182185
source.registerCorsConfiguration(APPLICATION_URL +"/*/view_marketplace",skipCheckCorsForAll);
186+
source.registerCorsConfiguration(APPLICATION_URL +"/marketplace-apps",skipCheckCorsForAll);
183187
source.registerCorsConfiguration(GITHUB_STAR,skipCheckCorsForAll);
184188
source.registerCorsConfiguration(ORGANIZATION_URL +"/*/datasourceTypes",skipCheckCorsForAll);
185189
source.registerCorsConfiguration(DATASOURCE_URL +"/jsDatasourcePlugins",skipCheckCorsForAll);
@@ -190,6 +194,7 @@ private CorsConfigurationSource buildCorsConfigurationSource() {
190194
source.registerCorsConfiguration(NewUrl.QUERY_URL +"/execute",skipCheckCorsForAll);
191195
source.registerCorsConfiguration(NewUrl.APPLICATION_URL +"/*/view",skipCheckCorsForAll);
192196
source.registerCorsConfiguration(NewUrl.APPLICATION_URL +"/*/view_marketplace",skipCheckCorsForAll);
197+
source.registerCorsConfiguration(NewUrl.APPLICATION_URL +"/marketplace-apps",skipCheckCorsForAll);
193198
source.registerCorsConfiguration(NewUrl.ORGANIZATION_URL +"/*/datasourceTypes",skipCheckCorsForAll);
194199
source.registerCorsConfiguration(NewUrl.DATASOURCE_URL +"/jsDatasourcePlugins",skipCheckCorsForAll);
195200

‎server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/home/UserHomeApiServiceImpl.java‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
importorg.lowcoder.domain.user.service.UserService;
4141
importorg.lowcoder.domain.user.service.UserStatusService;
4242
importorg.lowcoder.infra.util.NetworkUtils;
43+
importorg.lowcoder.sdk.config.CommonConfig;
4344
importorg.springframework.beans.factory.annotation.Autowired;
4445
importorg.springframework.stereotype.Component;
4546
importorg.springframework.web.server.ServerWebExchange;
@@ -80,6 +81,9 @@ public class UserHomeApiServiceImpl implements UserHomeApiService {
8081
@Autowired
8182
privateUserApplicationInteractionServiceuserApplicationInteractionService;
8283

84+
@Autowired
85+
privateCommonConfigconfig;
86+
8387
@Override
8488
publicMono<UserProfileView>buildUserProfileView(Useruser,ServerWebExchangeexchange) {
8589

@@ -260,8 +264,13 @@ public Flux<ApplicationInfoView> getAllAuthorisedApplications4CurrentOrgMember(@
260264
@Override
261265
publicFlux<MarketplaceApplicationInfoView>getAllMarketplaceApplications(@NullableApplicationTypeapplicationType) {
262266

263-
returnsessionUserService.getVisitorOrgMemberCache()
264-
.flatMapMany(orgMember -> {
267+
returnsessionUserService.isAnonymousUser()
268+
.flatMapMany(isAnonymousUser -> {
269+
270+
if(config.getMarketplace().isPrivateMode() &&isAnonymousUser) {
271+
returnMono.empty();
272+
}
273+
265274
// application flux
266275
Flux<Application>applicationFlux =Flux.defer(() ->applicationService.findAllMarketplaceApps())
267276
.filter(application ->isNull(applicationType) ||application.getApplicationType() ==applicationType.getValue())
@@ -287,11 +296,11 @@ public Flux<MarketplaceApplicationInfoView> getAllMarketplaceApplications(@Nulla
287296

288297
returnapplicationFlux
289298
.flatMap(application ->Mono.zip(Mono.just(application),userMapMono,orgMapMono))
290-
.map(tuple -> {
299+
.map(tuple2 -> {
291300
// build view
292-
Applicationapplication =tuple.getT1();
293-
Map<String,User>userMap =tuple.getT2();
294-
Map<String,Organization>orgMap =tuple.getT3();
301+
Applicationapplication =tuple2.getT1();
302+
Map<String,User>userMap =tuple2.getT2();
303+
Map<String,Organization>orgMap =tuple2.getT3();
295304
MarketplaceApplicationInfoViewmarketplaceApplicationInfoView =MarketplaceApplicationInfoView.builder()
296305
.applicationId(application.getId())
297306
.name(application.getName())

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp