use of io.jpom.permission.Feature in project Jpom by dromara.
the class NodeScriptController method save.
/**
* 保存脚本
*
* @return json
*/
@RequestMapping(value = "save.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@Feature(method = MethodFeature.EDIT)
public String save(String autoExecCron) {
NodeModel node = getNode();
this.checkCron(autoExecCron);
JsonMessage<Object> request = NodeForward.request(node, getRequest(), NodeUrl.Script_Save);
if (request.getCode() == HttpStatus.OK.value()) {
nodeScriptServer.syncNode(node);
}
return request.toString();
}
use of io.jpom.permission.Feature in project Jpom by dromara.
the class NodeScriptController method clearAll.
/**
* 删除节点缓存的所有脚本模版
*
* @return json
*/
@GetMapping(value = "clear_all", produces = MediaType.APPLICATION_JSON_VALUE)
@SystemPermission(superUser = true)
@Feature(method = MethodFeature.DEL)
public String clearAll() {
Entity where = Entity.create();
where.set("id", " <> id");
int del = nodeScriptServer.del(where);
return JsonMessage.getString(200, "成功删除" + del + "条脚本模版缓存");
}
use of io.jpom.permission.Feature in project Jpom by dromara.
the class CacheManageController method serverCache.
/**
* get server's cache data
* 获取 Server 的缓存数据
*
* @return json
* @author Hotstrip
*/
@PostMapping(value = "server-cache", produces = MediaType.APPLICATION_JSON_VALUE)
@Feature(method = MethodFeature.LIST)
public String serverCache() {
Map<String, Object> map = new HashMap<>(10);
String fileSize = FileUtil.readableFileSize(BuildUtil.tempFileCacheSize);
map.put("cacheFileSize", fileSize);
map.put("dataSize", FileUtil.readableFileSize(ConfigBean.getInstance().getDataSizeCache()));
int size = LoginControl.LFU_CACHE.size();
File oldJarsPath = JpomManifest.getOldJarsPath();
map.put("oldJarsSize", FileUtil.readableFileSize(FileUtil.size(oldJarsPath)));
map.put("ipSize", size);
int oneLineCount = ServiceFileTailWatcher.getOneLineCount();
map.put("readFileOnLineCount", oneLineCount);
fileSize = FileUtil.readableFileSize(BuildUtil.buildCacheSize);
map.put("cacheBuildFileSize", fileSize);
map.put("taskList", CronUtils.list());
map.put("pluginSize", PluginFactory.size());
return JsonMessage.getString(200, "ok", map);
}
use of io.jpom.permission.Feature in project Jpom by dromara.
the class SystemConfigController method ipConfigData.
/**
* 加载服务端的 ip 白名单配置
*
* @return json
*/
@RequestMapping(value = "ip-config-data", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@Feature(cls = ClassFeature.SYSTEM_CONFIG_IP, method = MethodFeature.LIST)
public String ipConfigData() {
SystemIpConfigModel config = systemParametersServer.getConfig(SystemIpConfigModel.ID, SystemIpConfigModel.class);
JSONObject jsonObject = new JSONObject();
if (config != null) {
jsonObject.put("allowed", config.getAllowed());
jsonObject.put("prohibited", config.getProhibited());
}
// jsonObject.put("path", FileUtil.getAbsolutePath(systemIpConfigService.filePath()));
jsonObject.put("ip", getIp());
return JsonMessage.getString(200, "加载成功", jsonObject);
}
use of io.jpom.permission.Feature in project Jpom by dromara.
the class SystemConfigController method getWhitelist.
/**
* 加载白名单配置
*
* @return json
*/
@RequestMapping(value = "get_whitelist", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@Feature(cls = ClassFeature.SYSTEM_NODE_WHITELIST, method = MethodFeature.LIST)
public String getWhitelist() {
String workspaceId = nodeService.getCheckUserWorkspace(getRequest());
NodeAgentWhitelist config = systemParametersServer.getConfigDefNewInstance(StrUtil.format("node_whitelist_{}", workspaceId), NodeAgentWhitelist.class);
return JsonMessage.getString(200, "加载成功", config);
}
Aggregations