cancel
Showing results for 
Search instead for 
Did you mean: 

User Form Type does not show users when using LDAP

b_schnarr
Champ in-the-making
Champ in-the-making
Maybe, I did something wrong. When I use local users, the user form type works well and I can select my assignee. Now I connected the Explorer to an LDAP. The integration works well but the user form type does not show any users anymore.

Did I something wrong or is this a bug?

Thank you
Ben
39 REPLIES 39

b_schnarr
Champ in-the-making
Champ in-the-making
I tried it with a fresh installation of activiti 5.14 with LDAP. But no chance, the user form type doesn´t show any users. But this is a very fundamental function. Therefore: How can I assign tasks to users in the Activiti Explorer when using LDAP?

I appreciate all kind of help. It is very urgent. Thank you very much and best regards
Ben

tombo
Champ in-the-making
Champ in-the-making
Yes, this issue is present from version 5.13 and up. Using integration with any LDAP, search doesn’t find any users for assignment. I was unable to determine the cause.

Regards,
Boris

frederikherema1
Star Contributor
Star Contributor
Activiti explorer is a demo-app. UserFormType is an example on how to create custom renderers in the explorer app. This widget is based on a user-cache inside the explorer-app. Since the LDAP-implementation doesn't allow to list all users to fill that cache, the user-selection doesn't work. You'll have to create a custom widget/rendered that uses the raw LDAP to query against…

b_schnarr
Champ in-the-making
Champ in-the-making
Is it on the roadmap to make the User Form Type work with LDAP? It is IMHO a very important feature for the most companies.

b_schnarr
Champ in-the-making
Champ in-the-making
So I must define a LDAP Query which fetches all available users so that the user form type can use those IDs. Could you give me a hint how I could realize this? Which classes do I have to investigate and extend?

Thank you very much
Ben

frederikherema1
Star Contributor
Star Contributor
I just looked at the source, and it's not using a cache but the IdentityService (I guess it has been refactored since I last looked at it):

org.activiti.explorer.ui.custom.SelectUsersPopupWindow

protected void searchPeople(String searchText) {
    if (searchText.length() >= 2) {
      matchingUsersTable.removeAllItems();
     
      List<User> results = ProcessEngines.getDefaultProcessEngine()
              .getIdentityService()
              .createUserQuery()
              .userFullNameLike("%" + searchText + "%")
              .list();
     
      for (User user : results) {
        if (!multiSelect || !selectedUsersTable.containsId(user.getId())) {
          if (ignoredUserIds == null || !ignoredUserIds.contains(user.getId())) {
            addMatchingUser(user.getId(), user.getFirstName() + " " + user.getLastName());
          }
        }
      }
    }
  }

The default implementation of the LDAP supports the getFullNameLike(). Maybe the %-signs added around it causes the issue. Debug a bit in those classes to see what is causing this in your case…

b_schnarr
Champ in-the-making
Champ in-the-making
Thank you very much for your investigation. You wrote :"The default implementation of the LDAP supports the getFullNameLike()." Does that mean that actually, it SHOULD work with LDAP, too?

b_schnarr
Champ in-the-making
Champ in-the-making
One step further: I removed the %-signs and builded again. Now, when I type in the first 2 or 3 letters of the assignee I want to search for, I get the error: Warning: null
Look at this picture: https://www.dropbox.com/s/xdr1js0tozksjxn/ldap%202.png

When I continue to type more letters, he finds the users from the LDAP (https://www.dropbox.com/s/9d7qdvhag5xvf1g/ldap_user_form_type.png). I did nothing more. Just removed the %-signs. The method now looks like that:
<code>
List<User> results = ProcessEngines.getDefaultProcessEngine()
              .getIdentityService()
              .createUserQuery()
              .userFullNameLike(searchText)
              .list();
</code>

Tomcat logs say:

<code>
com.vaadin.event.ListenerMethod$MethodException: Invocation of method textChange in org.activiti.explorer.ui.custom.SelectUsersPopupWindow$1 failed.
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:530)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
at com.vaadin.ui.AbstractTextField.firePendingTextChangeEvent(AbstractTextField.java:470)
at com.vaadin.ui.AbstractTextField.changeVariables(AbstractTextField.java:251)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1460)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1404)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1329)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:761)
at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:325)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.activiti.explorer.filter.ExplorerFilter.doFilter(ExplorerFilter.java:44)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.activiti.ldap.LDAPUserManager.mapSearchResultToUser(LDAPUserManager.java:162)
at org.activiti.ldap.LDAPUserManager$2.executeInContext(LDAPUserManager.java:136)
at org.activiti.ldap.LDAPUserManager$2.executeInContext(LDAPUserManager.java:123)
at org.activiti.ldap.LDAPTemplate.execute(LDAPTemplate.java:44)
at org.activiti.ldap.LDAPUserManager.findUserByQueryCriteria(LDAPUserManager.java:123)
at org.activiti.engine.impl.UserQueryImpl.executeList(UserQueryImpl.java:163)
at org.activiti.engine.impl.AbstractQuery.execute(AbstractQuery.java:139)
at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
at org.activiti.engine.impl.AbstractQuery.list(AbstractQuery.java:113)
at org.activiti.explorer.ui.custom.SelectUsersPopupWindow.searchPeople(SelectUsersPopupWindow.java:180)
at org.activiti.explorer.ui.custom.SelectUsersPopupWindow$1.textChange(SelectUsersPopupWindow.java:142)
at sun.reflect.GeneratedMethodAccessor442.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
… 33 more

</code>

I recognized the following. When I type in random letters like fgfgfgdcvbjnh, I correctly get no user and no error. When I type in the first two letters of kermit (ke) or gonzo (go), I get the mentioned error. Very strange

Thanks for your answers

jbarrez
Star Contributor
Star Contributor
that extra null check wouldn't hurt.

But if something causes a null pointer 'sometimes', that doesn't sound right. Would be better if it is consistent 😉