use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class PublishPageDirective method execute.
@Override
public void execute(RenderHandler handler) throws IOException, Exception {
String path = handler.getString("path", SEPARATOR);
SysSite site = getSite(handler);
String fullPath = siteComponent.getWebTemplateFilePath(site, path);
File file = new File(fullPath);
if (file.isFile()) {
Map<String, Boolean> map = new LinkedHashMap<>();
CmsPageMetadata metadata = metadataComponent.getTemplateMetadata(fullPath);
if (CommonUtils.notEmpty(metadata.getPublishPath())) {
try {
templateComponent.createStaticFile(site, SiteComponent.getFullFileName(site, path), metadata.getPublishPath(), null, metadata, null);
map.put(path, true);
} catch (IOException | TemplateException e) {
map.put(path, false);
}
handler.put("map", map).render();
}
} else if (file.isDirectory()) {
handler.put("map", deal(site, path)).render();
}
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class SysDeptDirective method execute.
@Override
public void execute(RenderHandler handler) throws IOException, Exception {
Integer id = handler.getInteger("id");
SysSite site = getSite(handler);
if (CommonUtils.notEmpty(id)) {
SysDept entity = service.getEntity(id);
if (null != entity && site.getId() == entity.getSiteId()) {
handler.put("object", entity).render();
}
} else {
Integer[] ids = handler.getIntegerArray("ids");
if (CommonUtils.notEmpty(ids)) {
List<SysDept> entityList = service.getEntitys(ids);
Map<String, SysDept> map = new LinkedHashMap<>();
for (SysDept entity : entityList) {
if (site.getId() == entity.getSiteId()) {
map.put(String.valueOf(entity.getId()), entity);
}
}
handler.put("map", map).render();
}
}
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class SysSiteDirective method execute.
@Override
public void execute(RenderHandler handler) throws IOException, Exception {
Short id = handler.getShort("id");
if (CommonUtils.notEmpty(id)) {
SysSite entity = service.getEntity(id);
if (null != entity) {
handler.put("object", entity).render();
}
} else {
Short[] ids = handler.getShortArray("ids");
if (CommonUtils.notEmpty(ids)) {
List<SysSite> entityList = service.getEntitys(ids);
Map<String, SysSite> map = new LinkedHashMap<>();
for (SysSite entity : entityList) {
map.put(String.valueOf(entity.getId()), entity);
}
handler.put("map", map).render();
}
}
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class SysUserDirective method execute.
@Override
public void execute(RenderHandler handler) throws IOException, Exception {
Long id = handler.getLong("id");
SysSite site = getSite(handler);
if (CommonUtils.notEmpty(id)) {
SysUser entity = service.getEntity(id);
entity.setPassword(null);
if (null != entity && site.getId() == entity.getSiteId()) {
entity.setPassword(null);
handler.put("object", entity).render();
}
} else {
Long[] ids = handler.getLongArray("ids");
if (CommonUtils.notEmpty(ids)) {
List<SysUser> entityList = service.getEntitys(ids);
Map<String, SysUser> map = new LinkedHashMap<>();
for (SysUser entity : entityList) {
if (site.getId() == entity.getSiteId()) {
entity.setPassword(null);
map.put(String.valueOf(entity.getId()), entity);
}
}
handler.put("map", map).render();
}
}
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class SysAppTokenAdminController method delete.
/**
* @param authToken
* @param request
* @param session
* @param model
* @return view name
*/
@RequestMapping("delete")
public String delete(String authToken, HttpServletRequest request, HttpSession session, ModelMap model) {
SysSite site = getSite(request);
SysAppToken entity = service.getEntity(authToken);
Long userId = getAdminFromSession(session).getId();
if (null != entity) {
SysApp app = appService.getEntity(entity.getAppId());
if (null != app) {
if (ControllerUtils.verifyNotEquals("siteId", site.getId(), app.getSiteId(), model)) {
return TEMPLATE_ERROR;
}
service.delete(authToken);
logOperateService.save(new LogOperate(site.getId(), userId, LogLoginService.CHANNEL_WEB_MANAGER, "delete.apptoken", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
}
}
return TEMPLATE_DONE;
}
Aggregations