Skip to content

Commit 2cd7a91

Browse files
committed
fix:update /user/me,user/tenant,getAppHomePageId , remove permission verification for AI-related interfaces.
1 parent 4e264a1 commit 2cd7a91

6 files changed

Lines changed: 40 additions & 12 deletions

File tree

base/src/main/java/com/tinyengine/it/controller/UserController.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ public Result<User> me() {
8888
user.setUsername(loginUserContext.getLoginUserId());
8989
}
9090
user.setTenant(tenants);
91-
91+
user.setPassword(null);
92+
user.setPrivateKey(null);
93+
user.setPublicKey(null);
94+
user.setSalt(null);
9295
return Result.success(user);
9396
}
9497

base/src/main/java/com/tinyengine/it/login/config/LoginConfig.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ public void addInterceptors(InterceptorRegistry registry) {
3939
// 登录相关
4040
"/platform-center/api/user/login",
4141
// 忘记密码
42-
"/platform-center/api/user/forgot-password"
42+
"/platform-center/api/user/forgot-password",
43+
// AI
44+
"/app-center/api/ai/chat",
45+
"/app-center/api/chat/completions"
4346
);
4447
}
4548
}

base/src/main/java/com/tinyengine/it/login/controller/LoginController.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import com.tinyengine.it.model.entity.Tenant;
3232
import com.tinyengine.it.model.entity.User;
3333
import com.tinyengine.it.service.app.UserService;
34+
import com.tinyengine.it.service.platform.TenantService;
3435
import io.jsonwebtoken.Claims;
3536
import io.jsonwebtoken.Jwts;
3637
import io.swagger.v3.oas.annotations.Operation;
@@ -90,6 +91,8 @@ public class LoginController {
9091

9192
@Autowired
9293
LoginUserContext loginUserContext;
94+
@Autowired
95+
private TenantService tenantService;
9396

9497
/**
9598
* 注册
@@ -238,10 +241,12 @@ public Result<ValidationResult> validateToken(@RequestParam String token) {
238241
@SystemControllerLog(description = "设置当前组织")
239242
@GetMapping("/user/tenant")
240243
public Result<SSOTicket> setTenant(@RequestParam Integer tenantId) {
241-
List<Tenant> tenants = loginUserContext.getTenants();
242244
if (tenantId == null) {
243245
return Result.failed(ExceptionEnum.CM320);
244246
}
247+
248+
List<Tenant> tenants = tenantService.findTenantByTenantId(tenantId);
249+
245250
if (tenants == null || tenants.isEmpty()) {
246251
return Result.failed(ExceptionEnum.CM337);
247252
}

base/src/main/java/com/tinyengine/it/service/app/impl/PageServiceImpl.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -495,18 +495,16 @@ public Page addIsHome(Page pageInfo) {
495495
* @return the app home page id
496496
*/
497497
public int getAppHomePageId(int appId) {
498+
log.info("Getting home page ID for appId: {}, TenantId: {}", appId, loginUserContext.getTenantId());
498499
App appInfo = appMapper.queryAppById(appId, loginUserContext.getTenantId());
499500
// appHomePageId 存在为null的情况,即app没有设置首页
500-
Integer homePage = appInfo.getHomePage();
501-
502-
// 将 homePage 转换为整数,如果为空则默认为 0
503-
int id;
504-
if (homePage == null) {
505-
id = 0;
506-
return id;
501+
if (appInfo == null) {
502+
throw new ServiceException(ExceptionEnum.CM340.getResultCode(), "App not found for ID: " + appId+",TenantId:"+loginUserContext.getTenantId());
507503
}
508-
id = homePage;
509-
return id;
504+
// 将 homePage 转换为整数,如果为空则默认为 0
505+
Integer homePage = appInfo.getHomePage();
506+
log.info("Retrieved home page ID: {} for appId: {}", homePage, appId);
507+
return homePage != null ? homePage : 0;
510508
}
511509

512510
/**

base/src/main/java/com/tinyengine/it/service/platform/TenantService.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ public interface TenantService extends IService<Tenant> {
4646
*/
4747
List<Tenant> findTenantByCondition(Tenant tenant);
4848

49+
/**
50+
* 根据条件查询表t_tenant信息
51+
*
52+
* @param tenantId the tenantId
53+
* @return the list
54+
*/
55+
List<Tenant> findTenantByTenantId(Integer tenantId);
56+
4957
/**
5058
* 根据主键id删除t_tenant数据
5159
*

base/src/main/java/com/tinyengine/it/service/platform/impl/TenantServiceImpl.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ public List<Tenant> findTenantByCondition(Tenant tenant) {
8181
return baseMapper.queryTenantByCondition(tenant);
8282
}
8383

84+
/**
85+
* 根据条件查询表t_tenant信息
86+
*
87+
* @param tenantId the tenantId
88+
* @return the list
89+
*/
90+
@Override
91+
public List<Tenant> findTenantByTenantId(Integer tenantId) {
92+
return baseMapper.selectList(new QueryWrapper<Tenant>().eq("id", tenantId));
93+
}
94+
8495
/**
8596
* 根据主键id删除表t_tenant数据
8697
*

0 commit comments

Comments
 (0)