提交 66d59e40 编写于 作者: Z zhuangqian

更新readme

上级 def0299d
......@@ -9,8 +9,9 @@ PS:因为喜欢刀锋战士所以取名了SpringBlade,当中有一个类也命
2.[eova](http://www.oschina.net/p/eova)
3.[hutool](http://www.oschina.net/p/hutool)
4.[beetl](http://www.oschina.net/p/beetl)
4.[beetlsql](http://www.oschina.net/p/beetlsql)
5.[dreamlu](http://www.oschina.net/p/dreamlu)
6.[kisso](https://git.oschina.net/baomidou/kisso)
6.[kisso](http://www.oschina.net/p/kisso)
## 内置功能
......
......@@ -17,8 +17,6 @@ package com.smallchill.core.aop;
import java.lang.reflect.Method;
import javax.servlet.http.HttpServletRequest;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
......@@ -30,7 +28,6 @@ import com.smallchill.core.annotation.Permission;
import com.smallchill.core.exception.NoPermissionException;
import com.smallchill.core.toolbox.Func;
import com.smallchill.core.toolbox.check.PermissionCheckManager;
import com.smallchill.core.toolbox.kit.HttpKit;
/**
* AOP 权限自定义检查
......@@ -46,7 +43,6 @@ public class PermissionAop {
@Around("cutPermission()")
public Object doPermission(ProceedingJoinPoint point) throws Throwable {
HttpServletRequest request = HttpKit.getRequest();
MethodSignature ms = (MethodSignature) point.getSignature();
Method method = ms.getMethod();
Permission permission = method.getAnnotation(Permission.class);
......@@ -54,7 +50,7 @@ public class PermissionAop {
if ((permissions.length == 1 && Func.toStr(permissions[0]).equals("ALL"))
|| permissions == null || permissions.length == 0) {
//检查全体角色
boolean result = PermissionCheckManager.checkAll(request);
boolean result = PermissionCheckManager.checkAll();
if (result) {
return point.proceed();
} else {
......@@ -62,7 +58,7 @@ public class PermissionAop {
}
} else {
//检查指定角色
boolean result = PermissionCheckManager.check(permissions, request);
boolean result = PermissionCheckManager.check(permissions);
if (result) {
return point.proceed();
} else {
......
......@@ -15,7 +15,6 @@
*/
package com.smallchill.core.interfaces;
import javax.servlet.http.HttpServletRequest;
/**
* 检查用接口
......@@ -24,16 +23,14 @@ public interface ICheck {
/**
* 检查指定角色
* @param request
* @param permissions
* @return boolean
*/
boolean check(Object[] permissions, HttpServletRequest request);
boolean check(Object[] permissions);
/**
* 检查全体角色
* @param permissions
* @param request
* @return boolean
*/
boolean checkAll(HttpServletRequest request);
boolean checkAll();
}
......@@ -22,6 +22,7 @@ import com.smallchill.core.constant.Cst;
import com.smallchill.core.interfaces.ICheck;
import com.smallchill.core.shiro.ShiroKit;
import com.smallchill.core.toolbox.kit.CollectionKit;
import com.smallchill.core.toolbox.kit.HttpKit;
/**
* @title 权限自定义检查
......@@ -33,7 +34,7 @@ import com.smallchill.core.toolbox.kit.CollectionKit;
public class PermissionCheckFactory implements ICheck {
@Override
public boolean check(Object[] permissions, HttpServletRequest request) {
public boolean check(Object[] permissions) {
ShiroUser user = ShiroKit.getUser();
if (null == user) {
return false;
......@@ -46,7 +47,8 @@ public class PermissionCheckFactory implements ICheck {
}
@Override
public boolean checkAll(HttpServletRequest request) {
public boolean checkAll() {
HttpServletRequest request = HttpKit.getRequest();
ShiroUser user = ShiroKit.getUser();
if (null == user) {
return false;
......
......@@ -15,8 +15,6 @@
*/
package com.smallchill.core.toolbox.check;
import javax.servlet.http.HttpServletRequest;
import com.smallchill.core.constant.Cst;
import com.smallchill.core.interfaces.ICheck;
......@@ -47,11 +45,11 @@ public class PermissionCheckManager {
this.defaultCheckFactory = defaultCheckFactory;
}
public static boolean check(Object[] permissions, HttpServletRequest request) {
return me.defaultCheckFactory.check(permissions, request);
public static boolean check(Object[] permissions) {
return me.defaultCheckFactory.check(permissions);
}
public static boolean checkAll(HttpServletRequest request) {
return me.defaultCheckFactory.checkAll(request);
public static boolean checkAll() {
return me.defaultCheckFactory.checkAll();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册