mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-06-09 09:24:03 +08:00
优化权限控制
This commit is contained in:
@@ -61,6 +61,16 @@ public interface Permission extends Serializable {
|
||||
*/
|
||||
String ACTION_EXPORT = "export";
|
||||
|
||||
/**
|
||||
* 禁用
|
||||
*/
|
||||
String ACTION_DISABLE = "disable";
|
||||
|
||||
/**
|
||||
* 启用
|
||||
*/
|
||||
String ACTION_ENABLE = "enable";
|
||||
|
||||
/**
|
||||
* 获取权限ID,权限的唯一标识
|
||||
*
|
||||
|
||||
@@ -36,5 +36,8 @@ public interface UserAuthorizationListener {
|
||||
default void onAuthorizeFail(String username) {
|
||||
}
|
||||
|
||||
default void onLoginOut(Authorization authorization){
|
||||
|
||||
}
|
||||
void onAuthorizeSuccess(boolean isRemembered, Authorization authorization);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,13 @@ public class ListenerAuthorizingRealm extends AuthorizingRealm implements UserAu
|
||||
authorization.getUser().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoginOut(Authorization authorization) {
|
||||
if (null != authorization)
|
||||
getCache(authorization.getUser().getUsername()).clear();
|
||||
SecurityUtils.getSubject().logout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAuthorizeSuccess(boolean isRemembered, Authorization authorization) {
|
||||
SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
|
||||
|
||||
@@ -65,6 +65,7 @@ public class SimpleAuthorizeMethodInterceptor extends AuthorizingAnnotationMetho
|
||||
if (!(a instanceof Authorize)) return;
|
||||
MethodInterceptorHolder holder = MethodInterceptorHolder.current();
|
||||
if (null == holder) {
|
||||
logger.warn("MethodInterceptorHolder is null,maybe config is error!");
|
||||
return;
|
||||
}
|
||||
AuthorizeConfig authorizeConfig = new AuthorizeConfig(holder.getArgs());
|
||||
|
||||
@@ -61,10 +61,6 @@ public class TestController implements QueryController<UserEntity, String, Query
|
||||
return ResponseMessage.ok(entity);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws NoSuchMethodException {
|
||||
System.out.println(UserController.class.getMethod("list", Entity.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TestService getService() {
|
||||
return new TestService();
|
||||
|
||||
Reference in New Issue
Block a user