Skip to content

Commit

Permalink
增加AuthorizationInitializeEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou-hao committed Sep 3, 2019
1 parent bf2bd1e commit 0cf1bfa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package org.hswebframework.web.authorization;

import org.hswebframework.web.authorization.listener.event.AuthorizationInitializeEvent;

/**
* 授权信息初始化服务接口,使用该接口初始化用的权限信息
*
Expand All @@ -30,6 +32,7 @@ public interface AuthenticationInitializeService {
*
* @param userId 用户ID
* @return 权限信息
* @see AuthorizationInitializeEvent
*/
Authentication initUserAuthorization(String userId);

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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;
Expand Down Expand Up @@ -440,7 +441,7 @@ public Authentication initUserAuthorization(String userId) {
.listNoPaging();

authentication.setPermissions(initPermission(detailList));

eventPublisher.publishEvent(new AuthorizationInitializeEvent(authentication));
return authentication;
}

Expand Down

0 comments on commit 0cf1bfa

Please sign in to comment.