}
private String administrateGroup(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
String grpId = null;
try {
User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
grpId = (String)request.getParameter(Params.USER_GROUP.EDIT.PARAMS.GROUP_ID);
Group editedGroup = null;
if (grpId!=null) {
editedGroup = (Group) DaoFactory.getGroupDao().find(new Long(Long.parseLong(grpId)));
if (editedGroup == null) {
// No group found
LOGGER.debug("failed to retrieve user to modify in group form");
request.setAttribute(Params.REDIRECT.REQUEST.REDIRECTION_URL, ActionsHelper.homepageForward().getPath());
request.setAttribute(Params.REDIRECT.REQUEST.MESSAGE_KEY, "illegal.state");
return "redirect";
}
LOGGER.debug("editing group : " + editedGroup);
Collection admins = Arrays.asList(ServiceFactory.getUserService().getAdministratorsOfGroup(editedGroup));
Collection adminIds = CollectionUtils.collect(admins, new Transformer() {public Object transform(Object input) {return String.valueOf(((UserImpl)input).getId());};});
if (! adminIds.contains(String.valueOf(userLogged.getId()))) {
// a user try to edit a group without the right
LOGGER.debug("user " + userLogged.getLogin() + " try to edit " + editedGroup + " group without admin rights");
return ActionsHelper.homepageForwardName();
}
request.setAttribute(Params.USER_GROUP.SHOW.REQUEST.USER, userLogged);
prepareValueForAdministration(form, request, userLogged, editedGroup);
} else {