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

Commit060851e

Browse files
committed
PTM apps enhancements
1 parente5f2d29 commit060851e

File tree

11 files changed

+60
-8
lines changed

11 files changed

+60
-8
lines changed

‎server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/application/repository/ApplicationRepository.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public interface ApplicationRepository extends ReactiveMongoRepository<Applicati
3838
Flux<Application>findByPublicToAllIsTrueAndPublicToMarketplaceIsOrAgencyProfileIsAndIdIn
3939
(BooleanpublicToMarketplace,BooleanagencyProfile,Collection<String>ids);
4040

41+
Flux<Application>findByPublicToAllIsTrueAndPublicToMarketplaceIsAndAgencyProfileIsAndIdIn(BooleanpublicToMarketplace,BooleanagencyProfile,Collection<String>ids);
42+
4143
Flux<Application>findByPublicToAllIsTrueAndPublicToMarketplaceIsTrue();
4244

4345
Flux<Application>findByPublicToAllIsTrueAndAgencyProfileIsTrue();

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,24 @@ public Mono<Boolean> setApplicationAsAgencyProfile(String applicationId, boolean
198198

199199
@NonEmptyMono
200200
@SuppressWarnings("ReactiveStreamsNullableInLambdaInTransform")
201-
publicMono<Set<String>>getPublicApplicationIds(Collection<String>applicationIds,BooleanisAnonymous) {
202-
returnrepository.findByPublicToAllIsTrueAndPublicToMarketplaceIsOrAgencyProfileIsAndIdIn(!isAnonymous, !isAnonymous,applicationIds)
203-
.map(HasIdAndAuditing::getId)
204-
.collect(Collectors.toSet());
201+
publicMono<Set<String>>getPublicApplicationIds(Collection<String>applicationIds,BooleanisAnonymous,BooleanisPrivateMarketplace) {
202+
203+
if(isAnonymous) {
204+
if(isPrivateMarketplace) {
205+
returnrepository.findByPublicToAllIsTrueAndPublicToMarketplaceIsAndAgencyProfileIsAndIdIn(false,false,applicationIds)
206+
.map(HasIdAndAuditing::getId)
207+
.collect(Collectors.toSet());
208+
}else {
209+
returnrepository.findByPublicToAllIsTrueAndPublicToMarketplaceIsAndAgencyProfileIsAndIdIn(true,false,applicationIds)
210+
.map(HasIdAndAuditing::getId)
211+
.collect(Collectors.toSet());
212+
}
213+
}else {
214+
returnrepository.findByPublicToAllIsTrueAndPublicToMarketplaceIsOrAgencyProfileIsAndIdIn(true,true,applicationIds)
215+
.map(HasIdAndAuditing::getId)
216+
.collect(Collectors.toSet());
217+
}
218+
205219

206220
}
207221
}

‎server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/permission/service/ApplicationPermissionHandler.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected Mono<Map<String, List<ResourcePermission>>> getAnonymousUserPermission
4646
}
4747

4848
Set<String>applicationIds =newHashSet(resourceIds);
49-
returnMono.zip(applicationService.getPublicApplicationIds(applicationIds,Boolean.TRUE),
49+
returnMono.zip(applicationService.getPublicApplicationIds(applicationIds,Boolean.TRUE,config.getMarketplace().isPrivateMode()),
5050
templateSolution.getTemplateApplicationIds(applicationIds))
5151
.map(tuple -> {
5252
Set<String>publicAppIds =tuple.getT1();
@@ -61,7 +61,7 @@ protected Mono<Map<String, List<ResourcePermission>>> getAnonymousUserPermission
6161
(Collection<String>resourceIds,ResourceActionresourceAction) {
6262

6363
Set<String>applicationIds =newHashSet(resourceIds);
64-
returnMono.zip(applicationService.getPublicApplicationIds(applicationIds,Boolean.FALSE),
64+
returnMono.zip(applicationService.getPublicApplicationIds(applicationIds,Boolean.FALSE,config.getMarketplace().isPrivateMode()),
6565
templateSolution.getTemplateApplicationIds(applicationIds))
6666
.map(tuple -> {
6767
Set<String>publicAppIds =tuple.getT1();

‎server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/permission/service/ResourcePermissionHandler.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
importorg.lowcoder.domain.permission.model.ResourceRole;
2727
importorg.lowcoder.domain.permission.model.ResourceType;
2828
importorg.lowcoder.domain.permission.model.UserPermissionOnResourceStatus;
29+
importorg.lowcoder.sdk.config.CommonConfig;
2930
importorg.springframework.beans.factory.annotation.Autowired;
3031

3132
importcom.google.common.collect.Maps;
@@ -44,6 +45,9 @@ abstract class ResourcePermissionHandler {
4445
@Autowired
4546
privateOrgMemberServiceorgMemberService;
4647

48+
@Autowired
49+
protectedCommonConfigconfig;
50+
4751
publicMono<Map<String,List<ResourcePermission>>>getAllMatchingPermissions(StringuserId,
4852
Collection<String>resourceIds,
4953
ResourceActionresourceAction) {

‎server/api-service/lowcoder-sdk/src/main/java/org/lowcoder/sdk/config/CommonConfig.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class CommonConfig {
4444
privateCookiecookie =newCookie();
4545
privateJsExecutorjsExecutor =newJsExecutor();
4646
privateSet<String>disallowedHosts =newHashSet<>();
47+
privateMarketplacemarketplace =newMarketplace();
4748

4849
publicbooleanisSelfHost() {
4950
return !isCloud();
@@ -145,6 +146,12 @@ public static class JsExecutor {
145146
privateStringhost;
146147
}
147148

149+
@Data
150+
publicstaticclassMarketplace {
151+
152+
privatebooleanprivateMode =Boolean.TRUE;
153+
}
154+
148155

149156
@Getter
150157
@Setter

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public Mono<ResponseView<List<MarketplaceApplicationInfoView>>> getMarketplaceAp
155155
@Override
156156
publicMono<ResponseView<List<MarketplaceApplicationInfoView>>>getAgencyProfileApplications(@RequestParam(required =false)IntegerapplicationType) {
157157
ApplicationTypeapplicationTypeEnum =applicationType ==null ?null :ApplicationType.fromValue(applicationType);
158-
returnuserHomeApiService.getAllMarketplaceApplications(applicationTypeEnum)
158+
returnuserHomeApiService.getAllAgencyProfileApplications(applicationTypeEnum)
159159
.collectList()
160160
.map(ResponseView::success);
161161
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22

33
importlombok.Builder;
44
importlombok.Getter;
5+
importlombok.Setter;
56
importorg.lowcoder.domain.application.model.ApplicationStatus;
67

78
@Builder
89
@Getter
10+
@Setter
911
publicclassMarketplaceApplicationInfoView {
1012

13+
// marketplace specific details
14+
privateStringtitle;
15+
privateStringdescription;
16+
privateStringcategory;
17+
1118
// org details
1219
privatefinalStringorgId;
1320
privatefinalStringorgName;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
108108
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,CONFIG_URL),// system config
109109
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,CONFIG_URL +"/deploymentId"),// system config
110110
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,APPLICATION_URL +"/*/view"),// application view
111+
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,APPLICATION_URL +"/*/view_marketplace"),// application view
111112
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,USER_URL +"/me"),
112113
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,USER_URL +"/currentUser"),
113114

@@ -132,6 +133,7 @@ SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
132133
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,NewUrl.CONFIG_URL +"/deploymentId"),
133134
ServerWebExchangeMatchers.pathMatchers(HttpMethod.HEAD,NewUrl.STATE_URL +"/healthCheck"),
134135
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,NewUrl.APPLICATION_URL +"/*/view"),
136+
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,NewUrl.APPLICATION_URL +"/*/view_marketplace"),
135137
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,NewUrl.USER_URL +"/me"),
136138
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,NewUrl.USER_URL +"/currentUser"),
137139
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET,NewUrl.GROUP_URL +"/list"),
@@ -177,6 +179,7 @@ private CorsConfigurationSource buildCorsConfigurationSource() {
177179
source.registerCorsConfiguration(GROUP_URL +"/list",skipCheckCorsForAll);
178180
source.registerCorsConfiguration(QUERY_URL +"/execute",skipCheckCorsForAll);
179181
source.registerCorsConfiguration(APPLICATION_URL +"/*/view",skipCheckCorsForAll);
182+
source.registerCorsConfiguration(APPLICATION_URL +"/*/view_marketplace",skipCheckCorsForAll);
180183
source.registerCorsConfiguration(GITHUB_STAR,skipCheckCorsForAll);
181184
source.registerCorsConfiguration(ORGANIZATION_URL +"/*/datasourceTypes",skipCheckCorsForAll);
182185
source.registerCorsConfiguration(DATASOURCE_URL +"/jsDatasourcePlugins",skipCheckCorsForAll);
@@ -186,6 +189,7 @@ private CorsConfigurationSource buildCorsConfigurationSource() {
186189
source.registerCorsConfiguration(NewUrl.GROUP_URL +"/list",skipCheckCorsForAll);
187190
source.registerCorsConfiguration(NewUrl.QUERY_URL +"/execute",skipCheckCorsForAll);
188191
source.registerCorsConfiguration(NewUrl.APPLICATION_URL +"/*/view",skipCheckCorsForAll);
192+
source.registerCorsConfiguration(NewUrl.APPLICATION_URL +"/*/view_marketplace",skipCheckCorsForAll);
189193
source.registerCorsConfiguration(NewUrl.ORGANIZATION_URL +"/*/datasourceTypes",skipCheckCorsForAll);
190194
source.registerCorsConfiguration(NewUrl.DATASOURCE_URL +"/jsDatasourcePlugins",skipCheckCorsForAll);
191195

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ public Flux<MarketplaceApplicationInfoView> getAllMarketplaceApplications(@Nulla
292292
Applicationapplication =tuple.getT1();
293293
Map<String,User>userMap =tuple.getT2();
294294
Map<String,Organization>orgMap =tuple.getT3();
295-
returnMarketplaceApplicationInfoView.builder()
295+
MarketplaceApplicationInfoViewmarketplaceApplicationInfoView =MarketplaceApplicationInfoView.builder()
296296
.applicationId(application.getId())
297297
.name(application.getName())
298298
.applicationType(application.getApplicationType())
@@ -305,6 +305,16 @@ public Flux<MarketplaceApplicationInfoView> getAllMarketplaceApplications(@Nulla
305305
.createAt(application.getCreatedAt().toEpochMilli())
306306
.createBy(application.getCreatedBy())
307307
.build();
308+
309+
// marketplace specific fields
310+
Map<String,Object>marketplaceMeta = (Map<String,Object>)
311+
((Map<String,Object>)application.getEditingApplicationDSL().get("ui")).get("marketplaceMeta");
312+
marketplaceApplicationInfoView.setTitle((String)marketplaceMeta.get("title"));
313+
marketplaceApplicationInfoView.setCategory((String)marketplaceMeta.get("category"));
314+
marketplaceApplicationInfoView.setDescription((String)marketplaceMeta.get("description"));
315+
316+
returnmarketplaceApplicationInfoView;
317+
308318
});
309319

310320
});

‎server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ common:
4444
block-hound-enable:false
4545
js-executor:
4646
host:http://127.0.0.1:6060
47+
marketplace:
48+
private-mode:false
4749

4850
material:
4951
mongodb-grid-fs:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp