fix ssh 授权目录不能为根目录

This commit is contained in:
bwcx_jzy 2022-02-12 16:05:49 +08:00
parent 276006b657
commit 1c6c5d22cc
No known key found for this signature in database
GPG Key ID: 5E48E9372088B9E5
3 changed files with 68 additions and 63 deletions

View File

@ -9,6 +9,8 @@
### 🐞 解决BUG、优化功能
1. 【server】 ssh 授权目录不能为根目录
------

View File

@ -38,10 +38,12 @@ import com.alibaba.fastjson.JSONObject;
import com.jcraft.jsch.Session;
import io.jpom.common.BaseServerController;
import io.jpom.common.Type;
import io.jpom.common.interceptor.PermissionInterceptor;
import io.jpom.model.PageResultDto;
import io.jpom.model.data.AgentWhitelist;
import io.jpom.model.data.NodeModel;
import io.jpom.model.data.SshModel;
import io.jpom.model.data.UserModel;
import io.jpom.model.enums.BuildReleaseMethod;
import io.jpom.model.log.SshTerminalExecuteLog;
import io.jpom.plugin.ClassFeature;
@ -143,6 +145,14 @@ public class SshController extends BaseServerController {
sshModel.fileDirs(null);
} else {
List<String> list = StrSplitter.splitTrim(fileDirs, StrUtil.LF, true);
for (String s : list) {
String normalize = FileUtil.normalize(s);
int count = StrUtil.count(normalize, StrUtil.SLASH);
Assert.state(count >= 2, "ssh 授权目录不能是根目录");
}
//
UserModel userModel = getUser();
Assert.state(!userModel.isDemoUser(), PermissionInterceptor.DEMO_TIP);
sshModel.fileDirs(list);
}
sshModel.setHost(host);

View File

@ -3,25 +3,11 @@
<a-tabs type="card" default-active-key="1">
<a-tab-pane key="1" tab="服务端"> <upgrade></upgrade></a-tab-pane>
<a-tab-pane key="2" tab="所有节点(插件端)" force-render>
<a-space direction="vertical" size="middle">
<a-row>
<div>
<a-space>
<a-input class="search-input-item" v-model="listQuery['%id%']" placeholder="节点ID" />
<a-input class="search-input-item" v-model="listQuery['%name%']" placeholder="节点名称" />
<a-input class="search-input-item" v-model="listQuery['%url%']" placeholder="节点地址" />
<a-select show-search option-filter-prop="children" v-model="listQuery.group" allowClear placeholder="分组" class="search-input-item">
<a-select-option v-for="item in groupList" :key="item">{{ item }}</a-select-option>
</a-select>
<a-button :loading="loading" type="primary" @click="refresh">搜索</a-button>
</a-space>
</div>
</a-row>
<a-table
:columns="columns"
:data-source="listComputed"
bordered
size="middle"
rowKey="id"
class="table"
:pagination="this.listQuery.total / this.listQuery.limit > 1 ? (this, pagination) : false"
@ -30,6 +16,13 @@
>
<template slot="title">
<a-space>
<a-input class="search-input-item" v-model="listQuery['%name%']" placeholder="节点名称" />
<a-input class="search-input-item" v-model="listQuery['%url%']" placeholder="节点地址" />
<a-select show-search option-filter-prop="children" v-model="listQuery.group" allowClear placeholder="分组" class="search-input-item">
<a-select-option v-for="item in groupList" :key="item">{{ item }}</a-select-option>
</a-select>
<a-button :loading="loading" type="primary" @click="refresh">搜索</a-button>
<a-select v-model="temp.protocol" placeholder="升级协议" class="search-input-item">
<a-select-option value="WebSocket">WebSocket</a-select-option>
<a-select-option value="Http">Http</a-select-option>
@ -42,11 +35,12 @@
新版本
</a-button>
</a-upload>
<div>
<a-tooltip :title="`打包时间:${agentTimeStamp || '未知'}`">
Agent版本{{ agentVersion | version }}
<a-tag v-if="temp.upgrade" color="pink" @click="downloadRemoteEvent">新版本{{ temp.newVersion }} </a-tag>
</div>
<div>打包时间{{ agentTimeStamp | version }}</div>
<!-- </div> -->
</a-tooltip>
<!-- 打包时间{{ agentTimeStamp | version }}</div> -->
</a-space>
</template>
<template slot="version" slot-scope="text">
@ -62,10 +56,9 @@
</div>
</template>
<template slot="operation" slot-scope="text, record">
<a-button type="primary" @click="updateNodeHandler(record)">更新</a-button>
<a-button type="primary" size="small" @click="updateNodeHandler(record)">更新</a-button>
</template>
</a-table>
</a-space>
</a-tab-pane>
</a-tabs>
</div>
@ -106,7 +99,7 @@ export default {
{ title: "打包时间", dataIndex: "timeStamp", ellipsis: true, scopedSlots: { customRender: "timeStamp" } },
{ title: "状态", dataIndex: "status", ellipsis: true, scopedSlots: { customRender: "status" } },
// {title: '', dataIndex: 'autoUpdate', ellipsis: true, scopedSlots: {customRender: 'autoUpdate'}},
{ title: "操作", dataIndex: "operation", width: 120, scopedSlots: { customRender: "operation" }, align: "left" },
{ title: "操作", dataIndex: "operation", width: 90, scopedSlots: { customRender: "operation" }, align: "center" },
],
nodeVersion: {},
nodeStatus: {},