Project

General

Profile

bug #8066

CdmUserHelper.createAuthorityFor() causes flush of pending transactions

Added by Andreas Kohlbecker 4 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Highest
Category:
cdmlib
Target version:
Start date:
02/06/2019
Due date:
% Done:

100%

Severity:
normal
Found in Version:

Description

This was observed when testing for regressions related to #8039, the following steps where done in the registration UI

  1. add "existing name" to registration workingset
  2. add NameTypeDesignation
  3. create new "Typified Name"
  4. Save NameTypeDesignationPopupEditor

during the save operation a PermissionDeniedException occurred:

[reference_int] 12:10:42,124 ERROR [qtp93314457-353][eu.et.va.mv.AbstractPopupEditor] - eu.etaxonomy.cdm.database.PermissionDeniedException: [CREATE] not permitted for 'system-admin' on Registration[uuid:5920ff17-ff73-4930-acb7-3a5d2d906279', toString:'Registration#42<5920ff17-ff73-4930-acb7-3a5d2d906279>']

this was caused by a flush on dirty in the CdmUserHelper.createAuthorityFor() method

Associated revisions

Revision 4c2a3c2c (diff)
Added by Andreas Kohlbecker 4 months ago

fix #8066 doing a forced flush before changing the authentication

History

#1 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

A forced flush before changing the authentication should help in this case. Other options are to

  • do the authority creation in a separate transaction which would involve to use a different transaction isolation level.
  • use a temporary sub-session like in eu.etaxonomy.cdm.persistence.hibernate.GrantedAuthorityRevokingRegistrationUpdateLister.deleteAuthorities()

#2 Updated by Andreas Kohlbecker 4 months ago

Using the PROPAGATION_REQUIRES_NEW turned out to be in-appropriate. It was causing LazyInitializationExceptions, the same would be the case with temporary sub-sessions. In both cases it would be needed to reload cdm entity into the new session to avoid the LazyInitializationExceptions

Doing an explicit flush seems to be a good solution to the problem.

#3 Updated by Andreas Kohlbecker 4 months ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 50

#4 Updated by Andreas Kohlbecker 4 months ago

  • Status changed from Resolved to Closed
  • % Done changed from 50 to 100

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)