-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support hooking user creation (#6945)
#### What type of PR is this? /kind feature /area core /milestone 2.20.x #### What this PR does / why we need it: This PR adds support for hooking user creating. Plugin developers can define extension points of `UserPreCreatingHandler` and `UserPostCreatingHandler` to do something else. #### Does this PR introduce a user-facing change? ```release-note 支持在插件中定义用户创建的前置和后置处理器 ```
- Loading branch information
Showing
4 changed files
with
99 additions
and
7 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
api/src/main/java/run/halo/app/core/user/service/UserPostCreatingHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package run.halo.app.core.user.service; | ||
|
||
import org.pf4j.ExtensionPoint; | ||
import reactor.core.publisher.Mono; | ||
import run.halo.app.core.extension.User; | ||
|
||
/** | ||
* User post-creating handler. | ||
* | ||
* @author johnniang | ||
* @since 2.20.8 | ||
*/ | ||
public interface UserPostCreatingHandler extends ExtensionPoint { | ||
|
||
/** | ||
* Do something after creating user. | ||
* | ||
* @param user create user. | ||
* @return {@code Mono.empty()} if handling successfully. | ||
*/ | ||
Mono<Void> postCreating(User user); | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
api/src/main/java/run/halo/app/core/user/service/UserPreCreatingHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package run.halo.app.core.user.service; | ||
|
||
import org.pf4j.ExtensionPoint; | ||
import reactor.core.publisher.Mono; | ||
import run.halo.app.core.extension.User; | ||
|
||
/** | ||
* User pre-creating handler. | ||
* | ||
* @author johnniang | ||
* @since 2.20.8 | ||
*/ | ||
public interface UserPreCreatingHandler extends ExtensionPoint { | ||
|
||
/** | ||
* Do something before user creating. | ||
* | ||
* @param user modifiable user detail | ||
* @return {@code Mono.empty()} if handling successfully. | ||
*/ | ||
Mono<Void> preCreating(User user); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters