Skip to content

Commit 93e0051

Browse files
authored
Merge branch 'dev' into echarts-wordcloud
2 parents 2242865 + 7a7f854 commit 93e0051

File tree

8 files changed

+176
-23
lines changed

8 files changed

+176
-23
lines changed

client/yarn.lock

Lines changed: 130 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,16 @@ __metadata:
298298
languageName: node
299299
linkType: hard
300300

301+
"@babel/code-frame@npm:^7.22.13":
302+
version: 7.22.13
303+
resolution: "@babel/code-frame@npm:7.22.13"
304+
dependencies:
305+
"@babel/highlight": ^7.22.13
306+
chalk: ^2.4.2
307+
checksum: 22e342c8077c8b77eeb11f554ecca2ba14153f707b85294fcf6070b6f6150aae88a7b7436dd88d8c9289970585f3fe5b9b941c5aa3aa26a6d5a8ef3f292da058
308+
languageName: node
309+
linkType: hard
310+
301311
"@babel/compat-data@npm:^7.17.7, @babel/compat-data@npm:^7.20.5, @babel/compat-data@npm:^7.21.5":
302312
version: 7.21.9
303313
resolution: "@babel/compat-data@npm:7.21.9"
@@ -354,6 +364,18 @@ __metadata:
354364
languageName: node
355365
linkType: hard
356366

367+
"@babel/generator@npm:^7.23.0":
368+
version: 7.23.0
369+
resolution: "@babel/generator@npm:7.23.0"
370+
dependencies:
371+
"@babel/types": ^7.23.0
372+
"@jridgewell/gen-mapping": ^0.3.2
373+
"@jridgewell/trace-mapping": ^0.3.17
374+
jsesc: ^2.5.1
375+
checksum: 8efe24adad34300f1f8ea2add420b28171a646edc70f2a1b3e1683842f23b8b7ffa7e35ef0119294e1901f45bfea5b3dc70abe1f10a1917ccdfb41bed69be5f1
376+
languageName: node
377+
linkType: hard
378+
357379
"@babel/helper-annotate-as-pure@npm:^7.18.6":
358380
version: 7.18.6
359381
resolution: "@babel/helper-annotate-as-pure@npm:7.18.6"
@@ -442,6 +464,13 @@ __metadata:
442464
languageName: node
443465
linkType: hard
444466

467+
"@babel/helper-environment-visitor@npm:^7.22.20":
468+
version: 7.22.20
469+
resolution: "@babel/helper-environment-visitor@npm:7.22.20"
470+
checksum: d80ee98ff66f41e233f36ca1921774c37e88a803b2f7dca3db7c057a5fea0473804db9fb6729e5dbfd07f4bed722d60f7852035c2c739382e84c335661590b69
471+
languageName: node
472+
linkType: hard
473+
445474
"@babel/helper-function-name@npm:^7.18.9, @babel/helper-function-name@npm:^7.19.0, @babel/helper-function-name@npm:^7.21.0":
446475
version: 7.21.0
447476
resolution: "@babel/helper-function-name@npm:7.21.0"
@@ -452,6 +481,16 @@ __metadata:
452481
languageName: node
453482
linkType: hard
454483

484+
"@babel/helper-function-name@npm:^7.23.0":
485+
version: 7.23.0
486+
resolution: "@babel/helper-function-name@npm:7.23.0"
487+
dependencies:
488+
"@babel/template": ^7.22.15
489+
"@babel/types": ^7.23.0
490+
checksum: e44542257b2d4634a1f979244eb2a4ad8e6d75eb6761b4cfceb56b562f7db150d134bc538c8e6adca3783e3bc31be949071527aa8e3aab7867d1ad2d84a26e10
491+
languageName: node
492+
linkType: hard
493+
455494
"@babel/helper-hoist-variables@npm:^7.18.6":
456495
version: 7.18.6
457496
resolution: "@babel/helper-hoist-variables@npm:7.18.6"
@@ -461,6 +500,15 @@ __metadata:
461500
languageName: node
462501
linkType: hard
463502

503+
"@babel/helper-hoist-variables@npm:^7.22.5":
504+
version: 7.22.5
505+
resolution: "@babel/helper-hoist-variables@npm:7.22.5"
506+
dependencies:
507+
"@babel/types": ^7.22.5
508+
checksum: 394ca191b4ac908a76e7c50ab52102669efe3a1c277033e49467913c7ed6f7c64d7eacbeabf3bed39ea1f41731e22993f763b1edce0f74ff8563fd1f380d92cc
509+
languageName: node
510+
linkType: hard
511+
464512
"@babel/helper-member-expression-to-functions@npm:^7.21.5":
465513
version: 7.21.5
466514
resolution: "@babel/helper-member-expression-to-functions@npm:7.21.5"
@@ -566,20 +614,43 @@ __metadata:
566614
languageName: node
567615
linkType: hard
568616

617+
"@babel/helper-split-export-declaration@npm:^7.22.6":
618+
version: 7.22.6
619+
resolution: "@babel/helper-split-export-declaration@npm:7.22.6"
620+
dependencies:
621+
"@babel/types": ^7.22.5
622+
checksum: e141cace583b19d9195f9c2b8e17a3ae913b7ee9b8120246d0f9ca349ca6f03cb2c001fd5ec57488c544347c0bb584afec66c936511e447fd20a360e591ac921
623+
languageName: node
624+
linkType: hard
625+
569626
"@babel/helper-string-parser@npm:^7.21.5":
570627
version: 7.21.5
571628
resolution: "@babel/helper-string-parser@npm:7.21.5"
572629
checksum: 36c0ded452f3858e67634b81960d4bde1d1cd2a56b82f4ba2926e97864816021c885f111a7cf81de88a0ed025f49d84a393256700e9acbca2d99462d648705d8
573630
languageName: node
574631
linkType: hard
575632

633+
"@babel/helper-string-parser@npm:^7.22.5":
634+
version: 7.22.5
635+
resolution: "@babel/helper-string-parser@npm:7.22.5"
636+
checksum: 836851ca5ec813077bbb303acc992d75a360267aa3b5de7134d220411c852a6f17de7c0d0b8c8dcc0f567f67874c00f4528672b2a4f1bc978a3ada64c8c78467
637+
languageName: node
638+
linkType: hard
639+
576640
"@babel/helper-validator-identifier@npm:^7.18.6, @babel/helper-validator-identifier@npm:^7.19.1":
577641
version: 7.19.1
578642
resolution: "@babel/helper-validator-identifier@npm:7.19.1"
579643
checksum: 0eca5e86a729162af569b46c6c41a63e18b43dbe09fda1d2a3c8924f7d617116af39cac5e4cd5d431bb760b4dca3c0970e0c444789b1db42bcf1fa41fbad0a3a
580644
languageName: node
581645
linkType: hard
582646

647+
"@babel/helper-validator-identifier@npm:^7.22.20":
648+
version: 7.22.20
649+
resolution: "@babel/helper-validator-identifier@npm:7.22.20"
650+
checksum: 136412784d9428266bcdd4d91c32bcf9ff0e8d25534a9d94b044f77fe76bc50f941a90319b05aafd1ec04f7d127cd57a179a3716009ff7f3412ef835ada95bdc
651+
languageName: node
652+
linkType: hard
653+
583654
"@babel/helper-validator-option@npm:^7.18.6, @babel/helper-validator-option@npm:^7.21.0":
584655
version: 7.21.0
585656
resolution: "@babel/helper-validator-option@npm:7.21.0"
@@ -621,7 +692,18 @@ __metadata:
621692
languageName: node
622693
linkType: hard
623694

624-
"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.5, @babel/parser@npm:^7.21.8, @babel/parser@npm:^7.21.9":
695+
"@babel/highlight@npm:^7.22.13":
696+
version: 7.22.20
697+
resolution: "@babel/highlight@npm:7.22.20"
698+
dependencies:
699+
"@babel/helper-validator-identifier": ^7.22.20
700+
chalk: ^2.4.2
701+
js-tokens: ^4.0.0
702+
checksum: 84bd034dca309a5e680083cd827a766780ca63cef37308404f17653d32366ea76262bd2364b2d38776232f2d01b649f26721417d507e8b4b6da3e4e739f6d134
703+
languageName: node
704+
linkType: hard
705+
706+
"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.8, @babel/parser@npm:^7.21.9":
625707
version: 7.21.9
626708
resolution: "@babel/parser@npm:7.21.9"
627709
bin:
@@ -630,6 +712,15 @@ __metadata:
630712
languageName: node
631713
linkType: hard
632714

715+
"@babel/parser@npm:^7.22.15, @babel/parser@npm:^7.23.0":
716+
version: 7.23.0
717+
resolution: "@babel/parser@npm:7.23.0"
718+
bin:
719+
parser: ./bin/babel-parser.js
720+
checksum: 453fdf8b9e2c2b7d7b02139e0ce003d1af21947bbc03eb350fb248ee335c9b85e4ab41697ddbdd97079698de825a265e45a0846bb2ed47a2c7c1df833f42a354
721+
languageName: node
722+
linkType: hard
723+
633724
"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:^7.18.6":
634725
version: 7.18.6
635726
resolution: "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:7.18.6"
@@ -1760,21 +1851,32 @@ __metadata:
17601851
languageName: node
17611852
linkType: hard
17621853

1763-
"@babel/traverse@npm:^7.20.5, @babel/traverse@npm:^7.21.5, @babel/traverse@npm:^7.4.5, @babel/traverse@npm:^7.7.2":
1764-
version: 7.21.5
1765-
resolution: "@babel/traverse@npm:7.21.5"
1854+
"@babel/template@npm:^7.22.15":
1855+
version: 7.22.15
1856+
resolution: "@babel/template@npm:7.22.15"
17661857
dependencies:
1767-
"@babel/code-frame": ^7.21.4
1768-
"@babel/generator": ^7.21.5
1769-
"@babel/helper-environment-visitor": ^7.21.5
1770-
"@babel/helper-function-name": ^7.21.0
1771-
"@babel/helper-hoist-variables": ^7.18.6
1772-
"@babel/helper-split-export-declaration": ^7.18.6
1773-
"@babel/parser": ^7.21.5
1774-
"@babel/types": ^7.21.5
1858+
"@babel/code-frame": ^7.22.13
1859+
"@babel/parser": ^7.22.15
1860+
"@babel/types": ^7.22.15
1861+
checksum: 1f3e7dcd6c44f5904c184b3f7fe280394b191f2fed819919ffa1e529c259d5b197da8981b6ca491c235aee8dbad4a50b7e31304aa531271cb823a4a24a0dd8fd
1862+
languageName: node
1863+
linkType: hard
1864+
1865+
"@babel/traverse@npm:^7.20.5, @babel/traverse@npm:^7.21.5, @babel/traverse@npm:^7.4.5, @babel/traverse@npm:^7.7.2":
1866+
version: 7.23.2
1867+
resolution: "@babel/traverse@npm:7.23.2"
1868+
dependencies:
1869+
"@babel/code-frame": ^7.22.13
1870+
"@babel/generator": ^7.23.0
1871+
"@babel/helper-environment-visitor": ^7.22.20
1872+
"@babel/helper-function-name": ^7.23.0
1873+
"@babel/helper-hoist-variables": ^7.22.5
1874+
"@babel/helper-split-export-declaration": ^7.22.6
1875+
"@babel/parser": ^7.23.0
1876+
"@babel/types": ^7.23.0
17751877
debug: ^4.1.0
17761878
globals: ^11.1.0
1777-
checksum: b403733fa7d858f0c8e224f0434a6ade641bc469a4f92975363391e796629d5bf53e544761dfe85039aab92d5389ebe7721edb309d7a5bb7df2bf74f37bf9f47
1879+
checksum: 26a1eea0dde41ab99dde8b9773a013a0dc50324e5110a049f5d634e721ff08afffd54940b3974a20308d7952085ac769689369e9127dea655f868c0f6e1ab35d
17781880
languageName: node
17791881
linkType: hard
17801882

@@ -1789,6 +1891,17 @@ __metadata:
17891891
languageName: node
17901892
linkType: hard
17911893

1894+
"@babel/types@npm:^7.22.15, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0":
1895+
version: 7.23.0
1896+
resolution: "@babel/types@npm:7.23.0"
1897+
dependencies:
1898+
"@babel/helper-string-parser": ^7.22.5
1899+
"@babel/helper-validator-identifier": ^7.22.20
1900+
to-fast-properties: ^2.0.0
1901+
checksum: 215fe04bd7feef79eeb4d33374b39909ce9cad1611c4135a4f7fdf41fe3280594105af6d7094354751514625ea92d0875aba355f53e86a92600f290e77b0e604
1902+
languageName: node
1903+
linkType: hard
1904+
17921905
"@bcoe/v8-coverage@npm:^0.2.3":
17931906
version: 0.2.3
17941907
resolution: "@bcoe/v8-coverage@npm:0.2.3"
@@ -5980,7 +6093,7 @@ __metadata:
59806093
languageName: node
59816094
linkType: hard
59826095

5983-
"chalk@npm:^2.0.0":
6096+
"chalk@npm:^2.0.0, chalk@npm:^2.4.2":
59846097
version: 2.4.2
59856098
resolution: "chalk@npm:2.4.2"
59866099
dependencies:
@@ -18921,9 +19034,9 @@ __metadata:
1892119034
linkType: hard
1892219035

1892319036
"word-wrap@npm:^1.2.3, word-wrap@npm:~1.2.3":
18924-
version: 1.2.3
18925-
resolution: "word-wrap@npm:1.2.3"
18926-
checksum: 30b48f91fcf12106ed3186ae4fa86a6a1842416df425be7b60485de14bec665a54a68e4b5156647dec3a70f25e84d270ca8bc8cd23182ed095f5c7206a938c1f
19037+
version: 1.2.4
19038+
resolution: "word-wrap@npm:1.2.4"
19039+
checksum: 8f1f2e0a397c0e074ca225ba9f67baa23f99293bc064e31355d426ae91b8b3f6b5f6c1fc9ae5e9141178bb362d563f55e62fd8d5c31f2a77e3ade56cb3e35bd1
1892719040
languageName: node
1892819041
linkType: hard
1892919042

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/authentication/AuthenticationServiceImpl.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package org.lowcoder.domain.authentication;
22

33
import lombok.extern.slf4j.Slf4j;
4+
import org.lowcoder.domain.organization.service.OrgMemberService;
45
import org.lowcoder.domain.organization.service.OrganizationService;
56
import org.lowcoder.sdk.auth.AbstractAuthConfig;
7+
import org.lowcoder.sdk.auth.EmailAuthConfig;
68
import org.lowcoder.sdk.config.AuthProperties;
79
import org.lowcoder.sdk.config.CommonConfig;
10+
import org.lowcoder.sdk.constants.AuthSourceConstants;
811
import org.lowcoder.sdk.constants.WorkspaceMode;
912
import org.springframework.beans.factory.annotation.Autowired;
1013
import org.springframework.stereotype.Service;
@@ -24,6 +27,10 @@ public class AuthenticationServiceImpl implements AuthenticationService {
2427

2528
@Autowired
2629
private OrganizationService organizationService;
30+
31+
@Autowired
32+
private OrgMemberService orgMemberService;
33+
2734
@Autowired
2835
private CommonConfig commonConfig;
2936
@Autowired
@@ -49,16 +56,27 @@ private Mono<FindAuthConfig> findAuthConfig(String orgId, Function<AbstractAuthC
4956

5057
@Override
5158
public Flux<FindAuthConfig> findAllAuthConfigs(String orgId, boolean enableOnly) {
52-
return findAllAuthConfigsByDomain()
59+
60+
Mono<FindAuthConfig> emailAuthConfigMono = orgMemberService.doesAtleastOneAdminExist()
61+
.map(doesAtleastOneAdminExist -> {
62+
boolean shouldEnableRegister = !doesAtleastOneAdminExist && authProperties.getEmail().isEnableRegister();
63+
return new FindAuthConfig
64+
(new EmailAuthConfig(AuthSourceConstants.EMAIL, authProperties.getEmail().isEnable(), shouldEnableRegister), null);
65+
});
66+
67+
68+
Flux<FindAuthConfig> findAuthConfigFlux = findAllAuthConfigsByDomain()
5369
.switchIfEmpty(findAllAuthConfigsForEnterpriseMode())
5470
.switchIfEmpty(findAllAuthConfigsForSaasMode(orgId))
5571
.filter(findAuthConfig -> {
5672
if (enableOnly) {
5773
return findAuthConfig.authConfig().isEnable();
5874
}
5975
return true;
60-
})
61-
.concatWithValues(new FindAuthConfig(DEFAULT_AUTH_CONFIG, null));
76+
});
77+
78+
return Flux.concat(findAuthConfigFlux, emailAuthConfigMono);
79+
6280
}
6381

6482
private Flux<FindAuthConfig> findAllAuthConfigsByDomain() {

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/organization/service/OrgMemberService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public interface OrgMemberService {
2424

2525
Mono<Long> getOrgMemberCount(String orgId);
2626

27+
Mono<Boolean> doesAtleastOneAdminExist();
28+
2729
Mono<Long> countAllActiveOrgs(String userId);
2830

2931
Mono<OrgMember> getOrgMember(String orgId, String userId);

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/organization/service/OrgMemberServiceImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ public Mono<Long> getOrgMemberCount(String orgId) {
125125
return biRelationService.countBySourceId(ORG_MEMBER, orgId);
126126
}
127127

128+
@Override
129+
public Mono<Boolean> doesAtleastOneAdminExist() {
130+
return biRelationService.countByRelation(ORG_MEMBER, MemberRole.ADMIN.getValue())
131+
.single()
132+
.map(count -> count != 0);
133+
}
134+
128135
@Override
129136
public Mono<Boolean> addMember(String orgId, String userId, MemberRole memberRole) {
130137
return biRelationService.addBiRelation(ORG_MEMBER, orgId,

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/query/service/QueryExecutionService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public Mono<QueryExecutionResult> executeQuery(Datasource datasource, Map<String
4848
String timeoutStr, QueryVisitorContext queryVisitorContext) {
4949

5050
int timeoutMs = QueryTimeoutUtils.parseQueryTimeoutMs(timeoutStr, requestParams, common.getMaxQueryTimeout());
51-
queryConfig.putIfAbsent("timeoutMs", timeoutMs);
51+
queryConfig.putIfAbsent("timeoutMs", String.valueOf(timeoutMs));
5252

5353
return Mono.defer(() -> {
5454
if (datasourceMetaInfoService.isJsDatasourcePlugin(datasource.getType())) {

server/api-service/lowcoder-infra/src/main/java/org/lowcoder/infra/birelation/BiRelationRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public interface BiRelationRepository extends ReactiveMongoRepository<BiRelation
2626

2727
Flux<BiRelation> findByBizTypeAndSourceIdAndRelation(BiRelationBizType bizType, String sourceId, String relation);
2828

29+
Mono<Long> countByBizTypeAndRelation(BiRelationBizType bizType, String relation);
30+
2931
Mono<Long> countByBizTypeAndSourceId(BiRelationBizType bizType, String sourceId);
3032

3133
Mono<Long> countByBizTypeAndTargetId(BiRelationBizType bizType, String targetId);

server/api-service/lowcoder-infra/src/main/java/org/lowcoder/infra/birelation/BiRelationService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ public Flux<BiRelation> getBySourceIdAndRelation(BiRelationBizType bizType, Stri
166166
return biRelationRepository.findByBizTypeAndSourceIdAndRelation(bizType, sourceId, relation);
167167
}
168168

169+
public Mono<Long> countByRelation(BiRelationBizType bizType, String relation) {
170+
return biRelationRepository.countByBizTypeAndRelation(bizType, relation);
171+
}
172+
169173
public Mono<Long> countBySourceId(BiRelationBizType bizType, String sourceId) {
170174
return biRelationRepository.countByBizTypeAndSourceId(bizType, sourceId);
171175
}

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ spring:
33
mongodb:
44
authentication-database: admin
55
auto-index-creation: false
6-
uri: mongodb://lowcoder:secret123@127.0.0.1/lowcoder?authSource=admin
6+
uri: mongodb://192.168.8.100:27017/lowcoder?authSource=admin
77
redis:
8-
url: redis://localhost:6379
8+
url: redis://192.168.8.100:6379
99
main:
1010
allow-bean-definition-overriding: true
1111
allow-circular-references: true
@@ -41,6 +41,8 @@ common:
4141
- '*'
4242
version: 1.1.8
4343
block-hound-enable: false
44+
js-executor:
45+
host: http://127.0.0.1:6060
4446

4547
material:
4648
mongodb-grid-fs:
@@ -52,3 +54,8 @@ springdoc:
5254
swagger-ui:
5355
path: /api/docs/swagger-ui
5456
paths-to-exclude: /api/v1/**
57+
58+
auth:
59+
email:
60+
enable: true
61+
enable-register: false

0 commit comments

Comments
 (0)