Revised transaction begin with check if it is already active. Added log of the storage ins use
This commit is contained in:
parent
3c4294c2d5
commit
1424b10942
|
@ -57,9 +57,11 @@ public class DeleteAccountResource {
|
|||
UserModel user = auth.getUser();
|
||||
|
||||
try {
|
||||
logger.debug("Beginning the transaction on transaction manager");
|
||||
session.getTransactionManager().begin();
|
||||
|
||||
if (!session.getTransactionManager().isActive()) {
|
||||
logger.debug("Beginning a new transaction on transaction manager");
|
||||
session.getTransactionManager().begin();
|
||||
}
|
||||
|
||||
logger.debug("Finding user model and setting it as not enabled in realm");
|
||||
session.users().getUserById(user.getId(), realm).setEnabled(false);
|
||||
|
||||
|
@ -71,9 +73,11 @@ public class DeleteAccountResource {
|
|||
logger.error("Cannot perform user model modifications", e);
|
||||
}
|
||||
|
||||
logger.debug("Getting the the configured avatar storage provider");
|
||||
AvatarStorageProvider avatarStorageProvider = session.getProvider(AvatarStorageProvider.class);
|
||||
if (avatarStorageProvider != null) {
|
||||
logger.debug("Deleting avatar from storage for the user");
|
||||
logger.tracev("Configured avatar storage provider type is {0}", avatarStorageProvider.getClass().getName());
|
||||
logger.debug("Deleting user's avatar from the configured storage");
|
||||
avatarStorageProvider.deleteAvatarImage(realm, user);
|
||||
} else {
|
||||
logger.warn("Cannot perform avatar import ince the avatar storage provider is null");
|
||||
|
|
Loading…
Reference in New Issue