use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.
the class SysSiteAdminController method delete.
/**
* @param id
* @param request
* @param session
* @param model
* @return view name
*/
@SuppressWarnings("unchecked")
@RequestMapping("delete")
public String delete(Short id, HttpServletRequest request, HttpSession session, ModelMap model) {
SysSite site = getSite(request);
if (ControllerUtils.verifyCustom("noright", !siteComponent.isMaster(site.getId()), model)) {
return TEMPLATE_ERROR;
}
SysSite entity = service.getEntity(id);
if (null != entity) {
service.delete(id);
Long userId = getAdminFromSession(session).getId();
Date now = CommonUtils.getDate();
String ip = RequestUtils.getIpAddress(request);
for (SysDomain domain : (List<SysDomain>) domainService.getPage(entity.getId(), null, null, null).getList()) {
domainService.delete(domain.getName());
logOperateService.save(new LogOperate(site.getId(), userId, LogLoginService.CHANNEL_WEB_MANAGER, "delete.domain", ip, now, JsonUtils.getString(entity)));
}
logOperateService.save(new LogOperate(site.getId(), userId, LogLoginService.CHANNEL_WEB_MANAGER, "delete.site", ip, now, JsonUtils.getString(entity)));
}
return TEMPLATE_DONE;
}
use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.
the class SysTaskAdminController method pause.
/**
* @param id
* @param request
* @param session
* @param model
* @return view name
*/
@RequestMapping("pause")
public String pause(Integer id, HttpServletRequest request, HttpSession session, ModelMap model) {
SysSite site = getSite(request);
SysTask entity = service.getEntity(id);
if (null != entity) {
if (ControllerUtils.verifyNotEquals("siteId", site.getId(), entity.getSiteId(), model)) {
return TEMPLATE_ERROR;
}
service.updateStatus(id, ScheduledTask.TASK_STATUS_PAUSE);
scheduledTask.pause(site, id);
logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "pause.task", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
}
return TEMPLATE_DONE;
}
use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.
the class SysTaskAdminController method save.
/**
* @param entity
* @param request
* @param session
* @param model
* @return view name
*/
@RequestMapping("save")
public String save(SysTask entity, HttpServletRequest request, HttpSession session, ModelMap model) {
SysSite site = getSite(request);
if (null != entity.getId()) {
SysTask oldEntity = service.getEntity(entity.getId());
if (null == oldEntity || ControllerUtils.verifyNotEquals("siteId", site.getId(), oldEntity.getSiteId(), model)) {
return TEMPLATE_ERROR;
}
entity.setUpdateDate(CommonUtils.getDate());
entity = service.update(entity.getId(), entity, ignoreProperties);
if (null != entity) {
logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "update.task", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
}
} else {
entity.setSiteId(site.getId());
service.save(entity);
logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "save.task", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
}
scheduledTask.create(site, entity.getId(), entity.getCronExpression());
return TEMPLATE_DONE;
}
use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.
the class SysTaskAdminController method resume.
/**
* @param id
* @param request
* @param session
* @param model
* @return view name
*/
@RequestMapping("resume")
public String resume(Integer id, HttpServletRequest request, HttpSession session, ModelMap model) {
SysSite site = getSite(request);
SysTask entity = service.getEntity(id);
if (null != entity) {
if (ControllerUtils.verifyNotEquals("siteId", site.getId(), entity.getSiteId(), model)) {
return TEMPLATE_ERROR;
}
service.updateStatus(id, ScheduledTask.TASK_STATUS_READY);
scheduledTask.resume(site, id);
logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "resume.task", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
}
return TEMPLATE_DONE;
}
use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.
the class SysUserAdminController method enable.
/**
* @param id
* @param request
* @param session
* @param model
* @return view name
*/
@RequestMapping(value = "enable", method = RequestMethod.POST)
public String enable(Long id, HttpServletRequest request, HttpSession session, ModelMap model) {
if (ControllerUtils.verifyEquals("admin.operate", getAdminFromSession(session).getId(), id, model)) {
return TEMPLATE_ERROR;
}
SysUser entity = service.getEntity(id);
if (null != entity) {
SysSite site = getSite(request);
if (ControllerUtils.verifyNotEquals("siteId", site.getId(), entity.getSiteId(), model)) {
return TEMPLATE_ERROR;
}
service.updateStatus(id, false);
logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "enable.user", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
}
return TEMPLATE_DONE;
}
Aggregations