@Override
public Page createPage() {
RoleTO roleTO = new RoleTO();
roleTO.setParent(selectedNode.getId());
RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
return form;
}
});
window.show(target);
}
}, ActionLink.ActionType.CREATE, xmlRolesReader.getAllAllowedRoles("Roles", "create"));
links.addWithRoles(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
window.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new StatusModalPage(pageRef, window, roleRestClient.read(selectedNode.getId()));
}
});
window.show(target);
}
}, ActionLink.ActionType.SEARCH, xmlRolesReader.getAllAllowedRoles("Roles", "update"));
links.addWithRoles(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
window.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
RoleTO roleTO = roleRestClient.read(selectedNode.getId());
RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
return form;
}
});
window.show(target);
}
}, ActionLink.ActionType.EDIT, xmlRolesReader.getAllAllowedRoles("Roles", "update"));
links.addWithRoles(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
try {
final RoleTO roleTO = roleRestClient.delete(selectedNode.getId());
((Roles) pageRef.getPage()).setModalResult(true);
window.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new ResultStatusModalPage.Builder(window, roleTO).build();
}
});
window.show(target);
} catch (SyncopeClientCompositeErrorException scce) {
error(getString(Constants.OPERATION_ERROR) + ": " + scce.getMessage());
target.add(((Roles) pageRef.getPage()).getFeedbackPanel());
}
}
}, ActionLink.ActionType.DELETE, xmlRolesReader.getAllAllowedRoles("Roles", "delete"));
final Form form = new Form("roleForm");
form.setModel(new CompoundPropertyModel(selectedNode));
form.setOutputMarkupId(true);
final RolePanel rolePanel = new RolePanel.Builder("rolePanel").form(form).roleTO(selectedNode).
roleModalPageMode(RoleModalPage.Mode.ADMIN).build();
rolePanel.setEnabled(false);
form.add(rolePanel);
final WebMarkupContainer userListContainer = new WebMarkupContainer("userListContainer");
userListContainer.setOutputMarkupId(true);
userListContainer.setEnabled(true);
userListContainer.add(new UserSearchResultPanel("userList", true, null, pageRef, userRestClient));
userListContainer.add(new ClearIndicatingAjaxButton("search", new ResourceModel("search"), pageRef) {
private static final long serialVersionUID = -958724007591692537L;
@Override
protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
final MembershipCond membershipCond = new MembershipCond();
membershipCond.setRoleName(selectedNode.getName());
NodeCond cond = NodeCond.getLeafCond(membershipCond);
userListContainer.replace(new UserSearchResultPanel("userList", true, cond, pageRef, userRestClient));
target.add(userListContainer);
}
});
form.add(userListContainer);
add(form);
}