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 <johnniang@foxmail.com>
  • Loading branch information
JohnNiang committed Oct 16, 2024
1 parent c577deb commit 223e0b5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ValidationUtils {
public static final Pattern NAME_PATTERN = Pattern.compile(NAME_REGEX);

/**
* A-Z, a-z, 0-9, !@#$%^&* are allowed.
* {@code A-Z, a-z, 0-9, !@#$%^&*} are allowed.
*/
public static final String PASSWORD_REGEX = "^[A-Za-z0-9!@#$%^&*]+$";

Expand Down
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 223e0b5

Please sign in to comment.