import org.mxchange.jusercore.events.user.add.AdminUserAddedEvent;
import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
import org.mxchange.jusercore.events.user.linked.AdminUserLinkedEvent;
+import org.mxchange.jusercore.events.user.locked.AdminLockedUserEvent;
+import org.mxchange.jusercore.events.user.locked.AdminUserLockedEvent;
+import org.mxchange.jusercore.events.user.unlocked.AdminUnlockedUserEvent;
+import org.mxchange.jusercore.events.user.unlocked.AdminUserUnlockedEvent;
import org.mxchange.jusercore.events.user.update.AdminUpdatedUserDataEvent;
import org.mxchange.jusercore.events.user.update.AdminUserDataUpdatedEvent;
import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
*/
private String userLockReason;
+ /**
+ * Event being fired when an administrator has locked a user
+ */
+ @Inject
+ @Any
+ private Event<AdminLockedUserEvent> userLockedEvent;
+
/**
* Flag whether user must change password after login
*/
*/
private String userPasswordRepeat;
+ /**
+ * Event being fired when admin unlocks an account
+ */
+ @Inject
+ @Any
+ private Event<AdminUnlockedUserEvent> userUnlockedEvent;
+
/**
* Default constructor
*/
throw new IllegalArgumentException("this.userLockReason is empty"); //NOI18N
}
+ // Init updated user instance
+ User updatedUser;
+
try {
// Get base URL
String baseUrl = FacesUtils.generateBaseUrl();
// Call EJB to lock account
- this.adminUserBean.lockUserAccount(user, this.getUserLockReason(), baseUrl);
+ updatedUser = this.adminUserBean.lockUserAccount(user, this.getUserLockReason(), baseUrl);
} catch (final UserStatusLockedException | UserStatusUnconfirmedException | UserNotFoundException ex) {
// Throw again
throw new FaceletException(ex);
}
+ // Fire event
+ this.userLockedEvent.fire(new AdminUserLockedEvent(updatedUser));
+
+ // Clear bean
+ this.clear();
+
// Should go fine at this point, redirect to user profile
return "admin_show_user?faces-redirect=true&includeViewParams=true"; //NOI18N
}
throw new FaceletException(new UserStatusUnconfirmedException(user));
}
+ // Init updated user instance
+ User updatedUser;
+
try {
// Get base URL
String baseUrl = FacesUtils.generateBaseUrl();
// Call EJB to unlock account
- this.adminUserBean.unlockUserAccount(user, baseUrl);
+ updatedUser = this.adminUserBean.unlockUserAccount(user, baseUrl);
} catch (final UserStatusConfirmedException | UserStatusUnconfirmedException | UserNotFoundException ex) {
// Throw again
throw new FaceletException(ex);
}
+ // Fire event
+ this.userUnlockedEvent.fire(new AdminUserUnlockedEvent(updatedUser));
+
+ // Clear bean
+ this.clear();
+
// Should go fine at this point, redirect to user profile
return "admin_show_user?faces-redirect=true&includeViewParams=true"; //NOI18N
}