In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how the flowable workflow engine to achieve custom rights management, I hope you will learn something after reading this article, let's discuss it together!
Scenario: for the existing system integration workflow, the system already has a complete set of rights management modules, and it needs to be transformed into a separate micro-service, which can not be solved simply by establishing a view on the Internet. At the same time, considering the way that data is synchronized to flowable, the code of the existing system needs to be modified. Later, it will be troublesome to connect to the unmaintained system. If you choose a custom query, you can customize it more flexibly. Although there will be a certain amount of development workload, it is more in line with the current system status.
Idea: refer to the implementation of integrated LDAP
You can override the IdmIdentityServiceImpl class or directly implement the IdmIdentityService interface and use the implementation class as the idmIdentityService parameter in the ProcessEngineConfiguration.
Refer to LDAPIdentityServiceImpl's implementation of registering to the flowable engine configuration class
In SpringBoot, you can add the following code implementation to the ProcessEngineConfigurationbean definition:
@ Bean public EngineConfigurationConfigurer MyIdmEngineConfigurer () {return idmEngineConfiguration-> idmEngineConfiguration .setIdmIdentityService (new IdmIdentityServiceHandler ());}
IdmIdentityServiceHandler also refers to LDAPIdentityServiceImpl inheritance IdmIdentityServiceImpl for processing.
Package com.jxlgzwh.handler;import org.flowable.common.engine.api.FlowableException;import org.flowable.idm.api.*;import org.flowable.idm.engine.impl.IdmIdentityServiceImpl;import org.flowable.idm.engine.impl.persistence.entity.GroupEntityImpl;import org.flowable.idm.engine.impl.persistence.entity.UserEntityImpl;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import java.util.ArrayList;import java.util.List;public class IdmIdentityServiceHandler extends IdmIdentityServiceImpl {private static final Logger LOGGER = LoggerFactory.getLogger (IdmIdentityServiceHandler.class) @ Override public UserQuery createUserQuery () {System.out.println ("user query--"); return null;} @ Override public GroupQuery createGroupQuery () {System.out.println ("user Group query--"); return null;} @ Override public boolean checkPassword (String userId, String password) {return true } @ Override public List getGroupsWithPrivilege (String name) {System.out.println ("query--"); throw new FlowableException ("LDAP identity service doesn't support creating a new user");} @ Override public List getUsersWithPrivilege (String name) {System.out.println ("query--"); throw new FlowableException ("LDAP identity service doesn't support creating a new user") @ Override public User newUser (String userId) {throw new FlowableException ("LDAP identity service doesn't support creating a new user");} @ Override public void saveUser (User user) {throw new FlowableException ("LDAP identity service doesn't support saving an user");} @ Override public NativeUserQuery createNativeUserQuery () {throw new FlowableException ("LDAP identity service doesn't support native querying") @ Override public void deleteUser (String userId) {throw new FlowableException ("LDAP identity service doesn't support deleting an user");} @ Override public Group newGroup (String groupId) {throw new FlowableException ("LDAP identity service doesn't support creating a new group");} @ Override public NativeGroupQuery createNativeGroupQuery () {throw new FlowableException ("LDAP identity service doesn't support native querying") } @ Override public void saveGroup (Group group) {throw new FlowableException ("LDAP identity service doesn't support saving a group");} @ Override public void deleteGroup (String groupId) {throw new FlowableException ("LDAP identity service doesn't support deleting a group");}}
Considering that there is no need to maintain the permissions of flowable, there is no need to implement new and modified methods.
Verify: write a method to test whether it works
@ RequestMapping (value = "is") @ ResponseBody public String identityService () {identityService.createUserQuery (); return "Test";}
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.