Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose user and role services into plugins #6880

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading