Skip to content

Commit

Permalink
Expose user and role services into plugins
Browse files Browse the repository at this point in the history
Signed-off-by: JohnNiang <[email protected]>
  • Loading branch information
JohnNiang committed Oct 16, 2024
1 parent c577deb commit bdfd952
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import org.springframework.security.web.server.savedrequest.ServerRequestCache;
import run.halo.app.content.PostContentService;
import run.halo.app.core.extension.service.AttachmentService;
import run.halo.app.core.user.service.RoleService;
import run.halo.app.core.user.service.UserService;
import run.halo.app.extension.DefaultSchemeManager;
import run.halo.app.extension.ExtensionClient;
import run.halo.app.extension.ReactiveExtensionClient;
Expand Down Expand Up @@ -86,6 +88,10 @@ public static ApplicationContext create(ApplicationContext rootContext) {
.ifUnique(serverRequestCache ->
beanFactory.registerSingleton("serverRequestCache", serverRequestCache)
);
rootContext.getBeanProvider(UserService.class)
.ifUnique(userService -> beanFactory.registerSingleton("userService", userService));
rootContext.getBeanProvider(RoleService.class)
.ifUnique(roleService -> beanFactory.registerSingleton("roleService", roleService));
// TODO add more shared instance here

sharedContext.refresh();
Expand Down

0 comments on commit bdfd952

Please sign in to comment.