*
* @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
public ActionForward enter(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
UserImportForm userImportForm = (UserImportForm) form;
if(userImportForm.getMergeSelection() == null || userImportForm.getMergeSelection().equals("")){
userImportForm.setMergeSelection("none"); // initial setzp
}
Group groups[] = null;
Group groupToDisplay = null;
if (UserManager.isUserInRole(webUser, UserManagerBase.ADMINISTRATOR)) {
GroupManager groupMgm = new GroupManager(locale,session);
Long selectedGroupId = userImportForm.getGroupId();
if (selectedGroupId == null) {
// set the group name of the administrator group
groupToDisplay = webUser.getGroup();
} else {
groupToDisplay = groupMgm.getGroup(selectedGroupId);
}
// set an array of groups into the request
groups = groupMgm.getGroups();
} else if (UserManager.isUserInRole(webUser, UserManagerBase.GROUP_ADMINISTRATOR)) {
// this is a security aspect - > group administartors can only display its own group
groups = new Group[1];
Group gr = webUser.getGroup();
Hibernate.initialize(gr);
groupToDisplay = webUser.getGroup();
groups[0] = groupToDisplay;
} else { // role user - must not be allowed in struts-config
throw new BugException("illegal role");
}
req.getSession().setAttribute("groups", groups);
userImportForm.setGroupId(groupToDisplay.getId());
userImportForm.setGroupName(groupToDisplay.getGroupname());
if(userImportForm.getDelimiter() == null){
userImportForm.setDelimiter(DEFAULT_DELIMITER);
}
Hibernate.initialize(groupToDisplay); // used to fetch the data from db
UserSetManager userSetMgm = new UserSetManager(locale,session);
UserSet[] userSets = userSetMgm.getUserSets(groupToDisplay,false);