forked from github/dataease
Merge branch 'dev' into pr@dev_memory_component
This commit is contained in:
commit
b5af122774
@ -22,7 +22,6 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
@ -204,7 +203,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.dataease</groupId>
|
<groupId>io.dataease</groupId>
|
||||||
<artifactId>dataease-plugin-interface</artifactId>
|
<artifactId>dataease-plugin-interface</artifactId>
|
||||||
<version>${dataease.version}</version>
|
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
@ -215,12 +213,10 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.dataease</groupId>
|
<groupId>io.dataease</groupId>
|
||||||
<artifactId>dataease-plugin-view</artifactId>
|
<artifactId>dataease-plugin-view</artifactId>
|
||||||
<version>${dataease.version}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.dataease</groupId>
|
<groupId>io.dataease</groupId>
|
||||||
<artifactId>dataease-plugin-datasource</artifactId>
|
<artifactId>dataease-plugin-datasource</artifactId>
|
||||||
<version>${dataease.version}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- kettle及数据源依赖 -->
|
<!-- kettle及数据源依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -17,4 +17,9 @@ public class CurrentUserDto extends SysUserEntity implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty("权限集合")
|
@ApiModelProperty("权限集合")
|
||||||
private List<String> permissions;
|
private List<String> permissions;
|
||||||
|
|
||||||
|
public CurrentUserDto(String username, String nickName) {
|
||||||
|
super.setUsername(username);
|
||||||
|
super.setNickName(nickName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ public class ShiroServiceImpl implements ShiroService {
|
|||||||
filterChainDefinitionMap.put("/panel/group/exportDetails", ANON);
|
filterChainDefinitionMap.put("/panel/group/exportDetails", ANON);
|
||||||
filterChainDefinitionMap.put("/dataset/field/linkMultFieldValues", "link");
|
filterChainDefinitionMap.put("/dataset/field/linkMultFieldValues", "link");
|
||||||
filterChainDefinitionMap.put("/dataset/field/linkMappingFieldValues", "link");
|
filterChainDefinitionMap.put("/dataset/field/linkMappingFieldValues", "link");
|
||||||
filterChainDefinitionMap.put("/systemInfo/proxyUserLoginInfo/**", ANON);
|
filterChainDefinitionMap.put("/systemInfo/proxyUserLoginInfo", ANON);
|
||||||
|
|
||||||
filterChainDefinitionMap.put("/**", "authc");
|
filterChainDefinitionMap.put("/**", "authc");
|
||||||
|
|
||||||
|
@ -1,14 +1,20 @@
|
|||||||
package io.dataease.controller.sys;
|
package io.dataease.controller.sys;
|
||||||
|
|
||||||
|
import com.auth0.jwt.JWT;
|
||||||
|
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||||
|
import io.dataease.auth.filter.F2CLinkFilter;
|
||||||
import io.dataease.dto.UserLoginInfoDTO;
|
import io.dataease.dto.UserLoginInfoDTO;
|
||||||
import io.dataease.service.SystemInfoService;
|
import io.dataease.service.SystemInfoService;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
@ -23,8 +29,17 @@ public class SystemInfoController {
|
|||||||
return systemInfoService.getUserLoginInfo(null);
|
return systemInfoService.getUserLoginInfo(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("proxyUserLoginInfo/{userId}")
|
@GetMapping("proxyUserLoginInfo")
|
||||||
public UserLoginInfoDTO proxyUserLoginInfo(@PathVariable String userId) throws IOException {
|
public UserLoginInfoDTO proxyUserLoginInfo() throws IOException {
|
||||||
return systemInfoService.getUserLoginInfo(userId);
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
|
||||||
|
.getRequest();
|
||||||
|
String linkToken = request.getHeader(F2CLinkFilter.LINK_TOKEN_KEY);
|
||||||
|
if (StringUtils.isNotEmpty(linkToken)) {
|
||||||
|
DecodedJWT jwt = JWT.decode(linkToken);
|
||||||
|
return systemInfoService.getUserLoginInfo(jwt.getClaim("userId").asLong());
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,4 +22,9 @@ public class UserLoginInfoDTO {
|
|||||||
this.userInfo = userInfo;
|
this.userInfo = userInfo;
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserLoginInfoDTO(String username, String nickname, String ip) {
|
||||||
|
this.userInfo = new CurrentUserDto(username, nickname);
|
||||||
|
this.ip = ip;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,10 @@ package io.dataease.service;
|
|||||||
|
|
||||||
import io.dataease.auth.api.dto.CurrentUserDto;
|
import io.dataease.auth.api.dto.CurrentUserDto;
|
||||||
import io.dataease.commons.utils.AuthUtils;
|
import io.dataease.commons.utils.AuthUtils;
|
||||||
import io.dataease.commons.utils.BeanUtils;
|
|
||||||
import io.dataease.commons.utils.IPUtils;
|
import io.dataease.commons.utils.IPUtils;
|
||||||
import io.dataease.dto.UserLoginInfoDTO;
|
import io.dataease.dto.UserLoginInfoDTO;
|
||||||
import io.dataease.plugins.common.base.domain.SysUser;
|
import io.dataease.plugins.common.base.domain.SysUser;
|
||||||
import io.dataease.plugins.common.base.mapper.SysUserMapper;
|
import io.dataease.plugins.common.base.mapper.SysUserMapper;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -18,14 +16,18 @@ public class SystemInfoService {
|
|||||||
@Resource
|
@Resource
|
||||||
private SysUserMapper sysUserMapper;
|
private SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
public UserLoginInfoDTO getUserLoginInfo(String userId) {
|
public UserLoginInfoDTO getUserLoginInfo(Long userId) {
|
||||||
if (StringUtils.isNotEmpty(userId)) {
|
if (userId != null) {
|
||||||
SysUser userInfo = sysUserMapper.selectByPrimaryKey(Long.parseLong(userId));
|
SysUser userInfo = sysUserMapper.selectByPrimaryKey(userId);
|
||||||
CurrentUserDto userDto = new CurrentUserDto();
|
return new UserLoginInfoDTO(userInfo.getUsername(), userInfo.getNickName(), IPUtils.get());
|
||||||
BeanUtils.copyBean(userDto, userInfo);
|
}
|
||||||
return new UserLoginInfoDTO(userDto, IPUtils.get());
|
CurrentUserDto userDto = AuthUtils.getUser();
|
||||||
|
if (userDto != null) {
|
||||||
|
return new UserLoginInfoDTO(userDto.getUsername(), userDto.getNickName(), IPUtils.get());
|
||||||
|
} else {
|
||||||
|
return new UserLoginInfoDTO(null, null, IPUtils.get());
|
||||||
}
|
}
|
||||||
return new UserLoginInfoDTO(AuthUtils.getUser(), IPUtils.get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,9 @@ export function userLoginInfo() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function proxyUserLoginInfo(userId) {
|
export function proxyUserLoginInfo() {
|
||||||
return request({
|
return request({
|
||||||
url: '/systemInfo/proxyUserLoginInfo/' + userId,
|
url: '/systemInfo/proxyUserLoginInfo',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
loading: false
|
loading: false
|
||||||
})
|
})
|
||||||
|
@ -485,7 +485,7 @@ export default {
|
|||||||
activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, waterDomId, this.canvasId, this.panelInfo.watermarkOpen)
|
activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, waterDomId, this.canvasId, this.panelInfo.watermarkOpen)
|
||||||
} else {
|
} else {
|
||||||
const method = this.userId ? proxyUserLoginInfo : userLoginInfo
|
const method = this.userId ? proxyUserLoginInfo : userLoginInfo
|
||||||
method(this.userId).then(res => {
|
method().then(res => {
|
||||||
this.userInfo = res.data
|
this.userInfo = res.data
|
||||||
activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, waterDomId, this.canvasId, this.panelInfo.watermarkOpen)
|
activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, waterDomId, this.canvasId, this.panelInfo.watermarkOpen)
|
||||||
})
|
})
|
||||||
|
27
pom.xml
27
pom.xml
@ -26,6 +26,33 @@
|
|||||||
<module>mobile</module>
|
<module>mobile</module>
|
||||||
<module>backend</module>
|
<module>backend</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.dataease</groupId>
|
||||||
|
<artifactId>dataease-plugin-interface</artifactId>
|
||||||
|
<version>${dataease.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.dataease</groupId>
|
||||||
|
<artifactId>dataease-plugin-view</artifactId>
|
||||||
|
<version>${dataease.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.dataease</groupId>
|
||||||
|
<artifactId>dataease-plugin-datasource</artifactId>
|
||||||
|
<version>${dataease.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user