#1 2021-01-22 21:26:40

tcarr
Member
Registered: 2018-02-08

Re-hired employee cannot log in

Hello,

We have an employee that was re-hired and receives an error when logging into ReportServer. The issue seems to be that the user had an entry in ReportServer before they left, they were removed by the LDAP integration, and then added back and there are somehow duplicate records somewhere.

Version: RS3.0.4-6004 2018-08-27-10-01-33

Error message:

javax.persistence.NonUniqueResultException: result returns more than one elements<br> at org.hibernate.jpa.internal.QueryImpl.getSingleResult(QueryImpl.java:492)<br> at org.hibernate.jpa.criteria.compile.CriteriaQueryTypeQueryAdapter.getSingleResult(CriteriaQueryTypeQueryAdapter.java:54)<br> at net.datenwerke.rs.utils.simplequery.byatt.QueryByAttProcessor.process(QueryByAttProcessor.java:107)<br> at net.datenwerke.rs.utils.simplequery.byatt.QueryByAttInterceptor.invoke(QueryByAttInterceptor.java:24)<br> at net.datenwerke.rs.passwordpolicy.service.lostpassword.LostPasswordPreAuthenticateHook.authenticating(LostPasswordPreAuthenticateHook.java:69)<br> at net.datenwerke.security.service.authenticator.AuthenticatorServiceImpl.authenticate(AuthenticatorServiceImpl.java:81)<br> at net.datenwerke.rs.authenticator.server.LoginHandlerImpl.authenticate(LoginHandlerImpl.java:60)<br> at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:66)<br> at net.datenwerke.security.service.security.aop.SecurityCheckInterceptor.invoke(SecurityCheckInterceptor.java:109)<br> at net.datenwerke.gf.service.gwtstacktrace.CatchStacktraceInterceptor.invoke(CatchStacktraceInterceptor.java:38)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)<br> at java.lang.reflect.Method.invoke(Method.java:498)<br> at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:587)<br> at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:333)<br> at net.datenwerke.security.service.security.aop.SecurityCheckInterceptor.invoke(SecurityCheckInterceptor.java:109)<br> at net.datenwerke.gf.service.gwtstacktrace.CatchStacktraceInterceptor.invoke(CatchStacktraceInterceptor.java:38)<br> at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:303)<br> at net.datenwerke.security.service.security.aop.SecurityCheckInterceptor.invoke(SecurityCheckInterceptor.java:109)<br> at net.datenwerke.gf.service.gwtstacktrace.CatchStacktraceInterceptor.invoke(CatchStacktraceInterceptor.java:38)<br> at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:373)<br> at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)<br> at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)<br> at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)<br> at net.datenwerke.security.service.security.aop.SecurityCheckInterceptor.invoke(SecurityCheckInterceptor.java:109)<br> at net.datenwerke.gf.service.gwtstacktrace.CatchStacktraceInterceptor.invoke(CatchStacktraceInterceptor.java:38)<br> at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)<br> at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)<br> at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)<br> at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)<br> at com.google.inject.persist.PersistFilter.doFilter(PersistFilter.java:89)<br> at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)<br> at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)<br> at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)<br> at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)<br> at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)<br> at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)<br> at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)<br> at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)<br> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)<br> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)<br> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)<br> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)<br> at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:616)<br> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)<br> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)<br> at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)<br> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)<br> at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:676)<br> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)<br> at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:877)<br> at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)<br> at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2527)<br> at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516)<br> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)<br> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)<br> at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)<br> at java.lang.Thread.run(Thread.java:748)<br>

Offline

#2 2021-01-25 16:41:51

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Re-hired employee cannot log in

Hi tcarr,

this sounds as the issue / solution described here: https://forum.reportserver.net/viewtopic.php?pid=8334
can you pls check this?

Regards,
Eduardo

Offline

#3 2021-01-26 16:07:15

tcarr
Member
Registered: 2018-02-08

Re: Re-hired employee cannot log in

Hi Eduardo,

The issue you provided is similar, but we don't see the users out side of 'root'. I ran the scripts anyway, and it did clean some things up, however it missed the specific user that's causing the issue. I think this is because the old user was in an organizational unit's folder, not root.

Offline

#4 2021-02-04 18:46:21

tcarr
Member
Registered: 2018-02-08

Re: Re-hired employee cannot log in

Hi Eduardo,

Is there a way to modify the script to find a specific username recursively and remove it? Our problem user isn't in root.

Offline

#5 2021-02-05 14:05:02

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Re-hired employee cannot log in

Hi tcarr,

you can use this:

net.datenwerke.security.service.usermanager.UserManagerService.getUserByName(String)

entering the corresponding username

For removing it, you can use:

net.datenwerke.security.service.usermanager.UserManagerService.remove(AbstractUserManagerNode)

Regards,
Eduardo

Offline

#6 2021-02-23 22:21:15

tcarr
Member
Registered: 2018-02-08

Re: Re-hired employee cannot log in

Hi Eduardo, I'm receiving this error when running the code:

reportserver$ exec purge_user.groovy
Script execution failed.
error message: javax.script.ScriptException: javax.persistence.NonUniqueResultException: result returns more than one elements (javax.persistence.NonUniqueResultException)
script arguments:
file: purge_user.groovy (id: 6054503, line 16)
line number: 16
line: AbstractUserManagerNode aumn = userManagerService.getUserByName(username);

The script I'm using:

import java.util.Map.Entry
import java.util.logging.Level
import java.util.logging.Logger


import net.datenwerke.security.service.usermanager.UserManagerService
import net.datenwerke.security.service.usermanager.entities.AbstractUserManagerNode
import net.datenwerke.security.service.usermanager.entities.Group
import net.datenwerke.security.service.usermanager.entities.OrganisationalUnit
import net.datenwerke.security.service.usermanager.entities.User

UserManagerService userManagerService = GLOBALS.getRsService(UserManagerService.class);



AbstractUserManagerNode aumn = userManagerService.getUserByName("username");
aumn.setWriteProtection(false);
userManagerService.remove(aumn);

Offline

#7 2021-02-24 09:57:08

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Re-hired employee cannot log in

Hi tcarr,

you have more than one user with the same username. You can also try with this method for getting users by ids:
UserManagerService.getUsers(java.util.Collection<java.lang.Long> ids): https://reportserver.net/api/current/ja … ollection-

Regards,
Eduardo

Offline

Board footer

Powered by FluxBB