Project

General

Profile

Revision 4c2a3c2c

ID4c2a3c2cc8e7583d613dd5e24afc5fdda3442816
Parent f08b6366
Child e734a4fb

Added by Andreas Kohlbecker over 2 years ago

fix #8066 doing a forced flush before changing the authentication

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/utility/CdmUserHelper.java
265 265
        User user = (User)userDetails;
266 266
        if(userDetails != null){
267 267
            try{
268
                // flush all pending transactions before changing the authentication,
269
                // see https://dev.e-taxonomy.eu/redmine/issues/8066 for discussion
270
                // in case of problems we may want to use another transaction propagation level
271
                // instead (PROPAGATION_REQUIRES_NEW) which would require to reload the cdm entity.
272
                repo().getSession().flush();
268 273
                getRunAsAutheticator().runAsAuthentication(Role.ROLE_USER_MANAGER);
269 274
                authority = new CdmAuthority(cdmEntity, property, crud);
270 275
                try {
......
274 279
                    }
275 280
                    newAuthorityAdded = user.getGrantedAuthorities().add(grantedAuthority);
276 281
                } catch (CdmAuthorityParsingException e) {
282
                    getRunAsAutheticator().restoreAuthentication();
277 283
                    throw new RuntimeException(e);
278 284
                }
279 285
                repo().getSession().flush();

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)