Skip to content

Commit

Permalink
Merge branch '2.4dev' into 2.4opt
Browse files Browse the repository at this point in the history
  • Loading branch information
elunez committed Dec 1, 2019
2 parents 175a2eb + ccca30f commit 284c25a
Show file tree
Hide file tree
Showing 49 changed files with 1,302 additions and 870 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ enum Type {
* 适用于简单连接查询,复杂的请自定义该注解,或者使用sql查询
*/
enum Join {
/** jie 2019-6-4 13:18:30 左连接 */
LEFT
/** jie 2019-6-4 13:18:30 右连接 */
, RIGHT
/** jie 2019-6-4 13:18:30 左右连接 */
LEFT, RIGHT
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
public class ElPermissionConfig {

public Boolean check(String ...permissions){
// 如果是匿名访问的,就放行
String anonymous = "anonymous";
if(Arrays.asList(permissions).contains(anonymous)){
return true;
}
// 获取当前用户的所有权限
List<String> elPermissions = SecurityUtils.getUserDetails().getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList());
// 判断当前用户的所有权限是否包含接口上定义的权限
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public class SwaggerConfig {
@Value("${jwt.header}")
private String tokenHeader;

@Value("${jwt.token-start-with}")
private String tokenStartWith;

@Value("${swagger.enabled}")
private Boolean enabled;

Expand All @@ -50,7 +53,7 @@ public Docket createRestApi() {
ticketPar.name(tokenHeader).description("token")
.modelRef(new ModelRef("string"))
.parameterType("header")
.defaultValue("Bearer ")
.defaultValue(tokenStartWith + " ")
.required(true)
.build();
pars.add(ticketPar.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@ public ResponseEntity handleException(Throwable e){
return buildResponseEntity(ApiError.error(e.getMessage()));
}

/**
* 处理 接口无权访问异常AccessDeniedException
*/
@ExceptionHandler(AccessDeniedException.class)
public ResponseEntity handleAccessDeniedException(AccessDeniedException e){
// 打印堆栈信息
log.error(ThrowableUtil.getStackTrace(e));
return buildResponseEntity(ApiError.error(FORBIDDEN.value(),e.getMessage()));
}

/**
* 处理自定义异常
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.zhengjie.utils;

import org.springframework.util.DigestUtils;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
Expand Down Expand Up @@ -82,11 +81,4 @@ private static byte[] hex2byte(byte[] b) {
}
return b2;
}

/**
* 密码加密
*/
public static String encryptPassword(String password){
return DigestUtils.md5DigestAsHex(password.getBytes());
}
}
2 changes: 0 additions & 2 deletions eladmin-common/src/main/java/me/zhengjie/utils/PageUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public class PageUtil extends cn.hutool.core.util.PageUtil {
public static List toPage(int page, int size , List list) {
int fromIndex = page * size;
int toIndex = page * size + size;

if(fromIndex > list.size()){
return new ArrayList();
} else if(toIndex >= list.size()) {
Expand All @@ -43,7 +42,6 @@ public static Map<String,Object> toPage(Object object, Object totalElements) {
Map<String,Object> map = new LinkedHashMap<>(2);
map.put("content",object);
map.put("totalElements",totalElements);

return map;
}

Expand Down
Loading

0 comments on commit 284c25a

Please sign in to comment.