[ 
https://issues.apache.org/jira/browse/FINERACT-1060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17148290#comment-17148290
 ] 

Petri Tuomola commented on FINERACT-1060:
-----------------------------------------

[~vorburger] I think the delete user API doesn't actually physically delete the 
row, it just renames the user to be called <userID>_DELETED_<username>. Does 
your database have a user with name "2_DELETED_system"? This would confirm your 
suspicion that someone has been playing with the delete API. But the audit 
trail seems to confirm this as well: 
[https://cui.fineract.dev/?baseApiUrl=https://demo.fineract.dev&tenantIdentifier=default#/viewaudit/396]

Then re the fix: I think regardless of what we do, there needs to be some 
"system" user used e.g. to record the changes made by all the batch jobs. Even 
if that user is not hardcoded, deleting / changing whatever user is configured 
for this would break a lot of stuff.

So as you indicate there are probably two fixes here:
 # Deleting the currently used system user (however identified) should not be 
allowed
 # It should be possible to change which user is used as the system user

The first one is more urgent but should be easy to fix by just adding a check 
to AppUserWritePlatformServiceJpaRepositoryImpl.deleteUser() so that it won't 
allow deleting the currently used system user. But given the current lookup for 
system user is with username, we also need to make sure that doesn't get 
modified in updateUser(). 

So then to fix #2 as well, we can make the system user a configuration 
parameter (but base it on userID, not username), remove the check from 
updateUser() and just leave the check in deleteUser(). 

> UserNotFoundException at 
> org.apache.fineract.useradministration.domain.AppUserRepositoryWrapper.fetchSystemUser()
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: FINERACT-1060
>                 URL: https://issues.apache.org/jira/browse/FINERACT-1060
>             Project: Apache Fineract
>          Issue Type: Bug
>    Affects Versions: 1.4.0
>            Reporter: Michael Vorburger
>            Priority: Blocker
>              Labels: beginner
>             Fix For: 1.4.0
>
>
> See FINERACT-932 for general background, and fix this problem:
> {noformat}org.quartz.SchedulerException: JobListener 'Global Listner' threw 
> exception: null
>       at 
> org.quartz.core.QuartzScheduler.notifyJobListenersToBeExecuted(QuartzScheduler.java:1929)
>  ~[quartz-2.3.2.jar:na]
>       at 
> org.quartz.core.JobRunShell.notifyListenersBeginning(JobRunShell.java:324) 
> ~[quartz-2.3.2.jar:na]
>       at org.quartz.core.JobRunShell.run(JobRunShell.java:173) 
> ~[quartz-2.3.2.jar:na]
>       at 
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) 
> ~[quartz-2.3.2.jar:na]
> Caused by: 
> org.apache.fineract.useradministration.exception.UserNotFoundException: null
>       at 
> org.apache.fineract.useradministration.domain.AppUserRepositoryWrapper.fetchSystemUser(AppUserRepositoryWrapper.java:39)
>  ~[app/:na]
>       at 
> org.apache.fineract.infrastructure.jobs.service.SchedulerJobListener.jobToBeExecuted(SchedulerJobListener.java:70)
>  ~[app/:na]
>       at 
> org.quartz.core.QuartzScheduler.notifyJobListenersToBeExecuted(QuartzScheduler.java:1927)
>  ~[quartz-2.3.2.jar:na]{noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to