Search in sources :

Example 6 with SysDomain

use of com.publiccms.entities.sys.SysDomain in project PublicCMS-preview by sanluan.

the class SysDomainAdminController method delete.

/**
 * @param id
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("delete")
public String delete(String id, HttpServletRequest request, HttpSession session, ModelMap model) {
    SysSite site = getSite(request);
    if (ControllerUtils.verifyCustom("noright", !siteComponent.isMaster(site.getId()), model)) {
        return TEMPLATE_ERROR;
    }
    SysDomain entity = service.getEntity(id);
    if (null != entity) {
        service.delete(id);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "delete.domain", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    siteComponent.clear();
    return TEMPLATE_DONE;
}
Also used : SysDomain(com.publiccms.entities.sys.SysDomain) LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with SysDomain

use of com.publiccms.entities.sys.SysDomain in project PublicCMS-preview by sanluan.

the class SysDomainAdminController method saveConfig.

/**
 * @param entity
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("saveConfig")
public String saveConfig(SysDomain entity, HttpServletRequest request, HttpSession session, ModelMap model) {
    if (CommonUtils.notEmpty(entity.getName())) {
        SysSite site = getSite(request);
        SysDomain oldEntity = service.getEntity(entity.getName());
        if (null == oldEntity || ControllerUtils.verifyNotEquals("siteId", site.getId(), oldEntity.getSiteId(), model)) {
            return TEMPLATE_ERROR;
        }
        entity = service.update(entity.getName(), entity, ignoreProperties);
        if (null != entity) {
            logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "update.domain", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
        }
        siteComponent.clear();
    }
    return TEMPLATE_DONE;
}
Also used : SysDomain(com.publiccms.entities.sys.SysDomain) LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with SysDomain

use of com.publiccms.entities.sys.SysDomain 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;
}
Also used : SysDomain(com.publiccms.entities.sys.SysDomain) LogOperate(com.publiccms.entities.log.LogOperate) List(java.util.List) Date(java.util.Date) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

SysDomain (com.publiccms.entities.sys.SysDomain)8 SysSite (com.publiccms.entities.sys.SysSite)6 LogOperate (com.publiccms.entities.log.LogOperate)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 SysDept (com.publiccms.entities.sys.SysDept)1 SysRole (com.publiccms.entities.sys.SysRole)1 SysRoleUser (com.publiccms.entities.sys.SysRoleUser)1 SysRoleUserId (com.publiccms.entities.sys.SysRoleUserId)1 SysUser (com.publiccms.entities.sys.SysUser)1 CmsPageMetadata (com.publiccms.views.pojo.entities.CmsPageMetadata)1 IOException (java.io.IOException)1 Date (java.util.Date)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1