Search in sources :

Example 36 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class SysConfigDataAdminController method delete.

/**
 * @param code
 * @param request
 * @param session
 * @return view name
 */
@RequestMapping("delete")
public String delete(String code, HttpServletRequest request, HttpSession session) {
    SysSite site = getSite(request);
    SysConfigData entity = service.getEntity(new SysConfigDataId(site.getId(), code));
    if (null != entity) {
        service.delete(entity.getId());
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "delete.configData", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
        configComponent.removeCache(site.getId(), entity.getId().getCode());
    }
    return TEMPLATE_DONE;
}
Also used : SysConfigData(com.publiccms.entities.sys.SysConfigData) LogOperate(com.publiccms.entities.log.LogOperate) SysConfigDataId(com.publiccms.entities.sys.SysConfigDataId) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 37 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class SysDeptAdminController method disable.

/**
 * @param id
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping(value = "disableUser", method = RequestMethod.POST)
public String disable(Long id, HttpServletRequest request, HttpSession session, ModelMap model) {
    if (ControllerUtils.verifyEquals("admin.operate", getAdminFromSession(session).getId(), id, model)) {
        return TEMPLATE_ERROR;
    }
    SysUser entity = userService.getEntity(id);
    if (null != entity) {
        SysSite site = getSite(request);
        SysDept dept = service.getEntity(entity.getDeptId());
        SysUser admin = getAdminFromSession(session);
        if (ControllerUtils.verifyNotEquals("siteId", site.getId(), entity.getSiteId(), model) || ControllerUtils.verifyNotEmpty("deptId", dept, model) || ControllerUtils.verifyNotEquals("userId", dept.getUserId(), admin.getId(), model)) {
            return TEMPLATE_ERROR;
        }
        userService.updateStatus(id, true);
        logOperateService.save(new LogOperate(site.getId(), admin.getId(), LogLoginService.CHANNEL_WEB_MANAGER, "disable.user", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysUser(com.publiccms.entities.sys.SysUser) SysDept(com.publiccms.entities.sys.SysDept) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 38 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class SysDomainAdminController method save.

/**
 * @param entity
 * @param id
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("save")
public String save(SysDomain entity, String id, HttpServletRequest request, HttpSession session, ModelMap model) {
    SysSite site = getSite(request);
    if (ControllerUtils.verifyCustom("noright", !siteComponent.isMaster(site.getId()), model)) {
        return TEMPLATE_ERROR;
    }
    if (ControllerUtils.verifyCustom("needAuthorizationEdition", !CmsVersion.isAuthorizationEdition(), model) || ControllerUtils.verifyCustom("unauthorizedDomain", !CmsVersion.verifyDomain(entity.getName()), model)) {
        return TEMPLATE_ERROR;
    }
    if (CommonUtils.notEmpty(id)) {
        if (!entity.getName().equals(id) && ControllerUtils.verifyHasExist("domain", service.getEntity(entity.getName()), model)) {
            return TEMPLATE_ERROR;
        }
        entity = service.update(id, entity);
        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)));
        }
    } else {
        if (ControllerUtils.verifyHasExist("domain", service.getEntity(entity.getName()), model)) {
            return TEMPLATE_ERROR;
        }
        if (0 == entity.getSiteId()) {
            entity.setSiteId(site.getId());
        }
        service.save(entity);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "save.domain", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    siteComponent.clear();
    return TEMPLATE_DONEANDREFRESH;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 39 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class SysRoleAdminController method save.

/**
 * @param entity
 * @param moduleIds
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("save")
public String save(SysRole entity, Integer[] moduleIds, HttpServletRequest request, HttpSession session, ModelMap model) {
    SysSite site = getSite(request);
    if (entity.isOwnsAllRight()) {
        moduleIds = null;
        entity.setShowAllModule(false);
    }
    if (null != entity.getId()) {
        SysRole oldEntity = service.getEntity(entity.getId());
        if (null == oldEntity || ControllerUtils.verifyNotEquals("siteId", site.getId(), oldEntity.getSiteId(), model)) {
            return TEMPLATE_ERROR;
        }
        entity = service.update(entity.getId(), entity, ignoreProperties);
        roleModuleService.updateRoleModules(entity.getId(), moduleIds);
        if (null != entity) {
            logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "update.role", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
        }
    } else {
        entity.setSiteId(site.getId());
        service.save(entity);
        if (CommonUtils.notEmpty(moduleIds)) {
            List<SysRoleModule> list = new ArrayList<>();
            for (int moduleId : moduleIds) {
                list.add(new SysRoleModule(new SysRoleModuleId(entity.getId(), moduleId)));
            }
            roleModuleService.save(list);
        }
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "save.role", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    roleAuthorizedService.dealRoleModules(entity.getId(), entity.isShowAllModule(), moduleService.getEntitys(moduleIds), moduleService.getPageUrl(null));
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysRole(com.publiccms.entities.sys.SysRole) ArrayList(java.util.ArrayList) SysRoleModule(com.publiccms.entities.sys.SysRoleModule) SysSite(com.publiccms.entities.sys.SysSite) SysRoleModuleId(com.publiccms.entities.sys.SysRoleModuleId) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 40 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class SysRoleAdminController method delete.

/**
 * @param id
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("delete")
public String delete(Integer id, HttpServletRequest request, HttpSession session, ModelMap model) {
    SysRole entity = service.getEntity(id);
    SysSite site = getSite(request);
    if (null != entity) {
        if (ControllerUtils.verifyNotEquals("siteId", site.getId(), entity.getSiteId(), model)) {
            return TEMPLATE_ERROR;
        }
        service.delete(id);
        @SuppressWarnings("unchecked") List<SysRoleUser> roleUserList = (List<SysRoleUser>) roleUserService.getPage(id, null, null, null).getList();
        for (SysRoleUser roleUser : roleUserList) {
            userService.deleteRoleIds(roleUser.getId().getUserId(), id);
        }
        roleUserService.deleteByRoleId(id);
        roleModuleService.deleteByRoleId(id);
        roleAuthorizedService.deleteByRoleId(id);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "delete.role", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysRole(com.publiccms.entities.sys.SysRole) ArrayList(java.util.ArrayList) List(java.util.List) SysSite(com.publiccms.entities.sys.SysSite) SysRoleUser(com.publiccms.entities.sys.SysRoleUser) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

LogOperate (com.publiccms.entities.log.LogOperate)117 SysSite (com.publiccms.entities.sys.SysSite)117 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)115 SysUser (com.publiccms.entities.sys.SysUser)15 IOException (java.io.IOException)13 CmsContent (com.publiccms.entities.cms.CmsContent)9 File (java.io.File)9 MultipartFile (org.springframework.web.multipart.MultipartFile)8 CmsCategory (com.publiccms.entities.cms.CmsCategory)7 TemplateException (freemarker.template.TemplateException)7 SysDept (com.publiccms.entities.sys.SysDept)6 SysTask (com.publiccms.entities.sys.SysTask)6 CmsPageMetadata (com.publiccms.views.pojo.entities.CmsPageMetadata)5 CmsPlaceMetadata (com.publiccms.views.pojo.entities.CmsPlaceMetadata)5 CmsPlace (com.publiccms.entities.cms.CmsPlace)4 CmsWord (com.publiccms.entities.cms.CmsWord)4 SysDomain (com.publiccms.entities.sys.SysDomain)4 SysRoleUser (com.publiccms.entities.sys.SysRoleUser)4 CmsModel (com.publiccms.views.pojo.entities.CmsModel)4 CmsCategoryType (com.publiccms.entities.cms.CmsCategoryType)3