if (!adminSecurityCheck(request)){
return mapping.findForward(BaseConstants.FWD_ADMIN_LOGIN);
}
SystemConfigVO sysConfigVO = sysConfigSerivce.getSystemConfig();
MemberForm memberForm = (MemberForm)form;
String adminAction = memberForm.getAdminAction();
String memberUserName = memberForm.getMemberUserName();
String deleteConfirm = memberForm.getDeleteConfirm();
if (adminAction != null && adminAction.length() > 0){
if ( adminAction.equalsIgnoreCase(BaseConstants.ADMIN_ACTION_ACTIVATE)){
logger.debug("ACTIVATE ACCOUNT - " + memberUserName);
//get the members status b4 updating
memberVO = memService.getMemberProfileByUserName(memberUserName);
// we only want to refresh the list if the user is newly registered
if (memberVO.getMemberStatus().equalsIgnoreCase(BaseConstants.ACCOUNT_UNAPPROVED)){
// send a welcome email
SendMailUtil.sendWelcomeNotice(memberVO.getEmail(), memberVO.getMemberUserName(),sysConfigVO);
}
memService.activateMemberByUserName(memberUserName, getLastModifiedBy(request));
setupAdminDesktop(request, memService, classNewsService, pmService);
action = BaseConstants.FWD_SUCCESS;
}
else if(adminAction.equalsIgnoreCase(BaseConstants.ADMIN_ACTION_MODIFY)){
logger.debug("FWD_MODIFY ACCOUNT - " + memberUserName);
memberVO = memService.getMemberProfileByUserName(memberUserName);
BeanUtils.copyProperties(memberForm, memberVO);
memberForm.setAdminAction("true");
action = BaseConstants.FWD_MODIFY;
// MESSENGER
try{
// IM
List<XlatDetailVO> availableMessengers = xlatService.getActiveGroupDetails(BaseConstants.GROUP_INSTANT_MESSENGERS);
List<XlatDetailVO> selectedMessengers = messengerService.getActiveMemberMessengers(memberVO.getMemberId());
List<XlatDetailVO> filteredAvailableIMs = filterMessengers(availableMessengers, selectedMessengers) ;
setSessionObject(request, BaseConstants.LU_AVAILABLE_IMS, filteredAvailableIMs);
setSessionObject(request, BaseConstants.LU_SELECTED_IMS, selectedMessengers);
}
catch(Exception e){
logger.debug(e.getMessage());
errors.add(BaseConstants.WARN_KEY, new ActionMessage("core.errorcode.00709"));
saveMessages(request, errors);
return mapping.getInputForward();
}
}
else if(adminAction.equalsIgnoreCase(BaseConstants.ADMIN_ACTION_DEACTIVATE)){
logger.debug("DEACTIVATE ACCOUNT - " + memberUserName);
memService.deactivateMemberByUserName(memberUserName, getLastModifiedBy(request));
setupAdminDesktop(request, memService, classNewsService, pmService);
action = BaseConstants.FWD_SUCCESS;
}
else if(adminAction.equalsIgnoreCase(BaseConstants.ADMIN_ACTION_DELETE)){
logger.debug("DELETE ACCOUNT - " + memberUserName);
deleteConfirm = StringUtil.safeString(deleteConfirm);
if ( deleteConfirm.length() == 0){
setRequestObject(request, "confirm", "show");
setupAdminDesktop(request, memService, classNewsService, pmService);
errors.add(BaseConstants.WARN_KEY, new ActionMessage("error.confirdelete"));
saveMessages(request, errors);
memberVO = memService.getMemberProfileByUserName(memberUserName);
BeanUtils.copyProperties(memberForm, memberVO);
return mapping.getInputForward();
}else{
String unActivatePattern = getSysProp().getValue("UNDELETEABLE_USERNAME_PATTERN");
boolean validName = true;
StringTokenizer st = new StringTokenizer(unActivatePattern, ",");
memberUserName = memberUserName.toLowerCase();
while (st.hasMoreTokens()) {
if (memberUserName.equals(st.nextToken().toLowerCase())) {
validName = false;
}
}
if( validName ){
memService.deleteMemberByUserName(memberUserName);
//also delete the mail folders
mfService.deleteMemberMessageFolders(memberUserName);
}
else{
memberVO = memService.getMemberProfileByUserName(memberUserName);
BeanUtils.copyProperties(memberForm, memberVO);
memberForm.setAdminAction("true");
memberVO = memService.getMemberProfileByUserName(memberUserName);
BeanUtils.copyProperties(memberForm, memberVO);
errors.add(BaseConstants.WARN_KEY, new ActionMessage("error.nondeletable", memberUserName));
saveMessages(request, errors);
return mapping.getInputForward();