private static final long serialVersionUID = 1L;
@Override
protected void onConfigure() {
super.onConfigure();
User user = userModel.getObject();
if (user != null) {
setVisible(AuthenticationType.LOCAL.equals(user.getAuthenticationType()));
}
}
};
changeUserPassword.add(new AjaxModalOpenBehavior(changePasswordPanel, MouseEvent.CLICK) {
private static final long serialVersionUID = -7179264122322968921L;
@Override
protected void onShow(AjaxRequestTarget target) {
}
});
add(changeUserPassword);
// Enable user link
add(new Link<User>("enableUser", userModel) {
private static final long serialVersionUID = 6157423807032594861L;
@Override
public void onClick() {
try {
userService.setActive(getModelObject(), true);
getSession().success(getString("administration.user.enable.success"));
} catch (Exception e) {
LOGGER.error("Error occured while enabling user", e);
getSession().error(getString("common.error"));
}
}
@Override
protected void onConfigure() {
super.onConfigure();
setVisible(!getModelObject().isActive());
}
});
// Disable user link
IModel<String> confirmationTextModel = new StringResourceModel(
"administration.user.disable.confirmation.text", null,
new Object[] { userModel.getObject().getDisplayName() }
);
add(new AjaxConfirmLink<User>("disableUser", userModel,
new ResourceModel("administration.user.disable.confirmation.title"),
confirmationTextModel,
new ResourceModel("common.confirm"),
new ResourceModel("common.cancel"),
null, false) {
private static final long serialVersionUID = 6157423807032594861L;
@Override
public void onClick(AjaxRequestTarget target) {
try {
userService.setActive(getModelObject(), false);
getSession().success(getString("administration.user.disable.success"));
} catch (Exception e) {
LOGGER.error("Error occured while disabling user", e);
getSession().error(getString("common.error"));
}
target.add(getPage());
FeedbackUtils.refreshFeedback(target, getPage());
}
@Override
protected void onConfigure() {
super.onConfigure();
User displayedUser = getModelObject();
User currentUser = MavenArtifactNotifierSession.get().getUser();
setVisible(!displayedUser.equals(currentUser) && displayedUser.isActive());
}
});
}