增加AuthorizationInitializeEvent

This commit is contained in:
zhou-hao
2019-09-03 19:54:04 +08:00
parent bf2bd1e796
commit 0cf1bfaba0
3 changed files with 17 additions and 1 deletions

View File

@@ -18,6 +18,8 @@
package org.hswebframework.web.authorization;
import org.hswebframework.web.authorization.listener.event.AuthorizationInitializeEvent;
/**
* 授权信息初始化服务接口,使用该接口初始化用的权限信息
*
@@ -30,6 +32,7 @@ public interface AuthenticationInitializeService {
*
* @param userId 用户ID
* @return 权限信息
* @see AuthorizationInitializeEvent
*/
Authentication initUserAuthorization(String userId);

View File

@@ -0,0 +1,12 @@
package org.hswebframework.web.authorization.listener.event;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.hswebframework.web.authorization.Authentication;
@Getter
@AllArgsConstructor
public class AuthorizationInitializeEvent {
private Authentication authentication;
}

View File

@@ -22,6 +22,7 @@ import org.hswebframework.web.authorization.Authentication;
import org.hswebframework.web.authorization.AuthenticationInitializeService;
import org.hswebframework.web.authorization.Permission;
import org.hswebframework.web.authorization.access.DataAccessConfig;
import org.hswebframework.web.authorization.listener.event.AuthorizationInitializeEvent;
import org.hswebframework.web.authorization.simple.SimpleAuthentication;
import org.hswebframework.web.authorization.simple.SimplePermission;
import org.hswebframework.web.authorization.simple.SimpleRole;
@@ -440,7 +441,7 @@ public class SimpleAuthorizationSettingService extends GenericEntityService<Auth
.listNoPaging();
authentication.setPermissions(initPermission(detailList));
eventPublisher.publishEvent(new AuthorizationInitializeEvent(authentication));
return authentication;
}