目录整编页面在根目录节点下的文件上传等功能增加对普通用户的限制

master
Guo XIn 1 year ago
parent c95d4282ce
commit 831fcc9694
  1. 9
      shandan-bianmu/src/main/resources/static/js/business/directory/directory.js
  2. 8
      shandan-common/src/main/resources/view/common/head.html

@ -143,6 +143,10 @@ function startRender() {
*/ */
metaListTable.addTableRowEvent('moveLink', function () { metaListTable.addTableRowEvent('moveLink', function () {
var table = layui.table, checkStatus = table.checkStatus('dirMetadataTable'), data = checkStatus.data; var table = layui.table, checkStatus = table.checkStatus('dirMetadataTable'), data = checkStatus.data;
if (basicData.id === 'ROOT' && !USER_ROLES.includes('ROLE_SA')){
layer.msg('没有权限');
return;
}
if (data.length < 1) { if (data.length < 1) {
layer.confirm("请选择要移动的文件!", function (index) { layer.confirm("请选择要移动的文件!", function (index) {
layer.close(index); layer.close(index);
@ -188,6 +192,7 @@ function startRender() {
} }
}) })
metaListTable.addTableRowEvent('addFile', function () { metaListTable.addTableRowEvent('addFile', function () {
upload(basicData, `${ctx}/sys/file/layer/dir?directoryId=${basicData.id}`, function (res) { upload(basicData, `${ctx}/sys/file/layer/dir?directoryId=${basicData.id}`, function (res) {
if (res.success) { if (res.success) {
refreshDirectoryNode(tempNode, basicData); refreshDirectoryNode(tempNode, basicData);
@ -277,6 +282,10 @@ function startRender() {
} }
function upload(basicData, url, callback) { function upload(basicData, url, callback) {
if (basicData.id === 'ROOT' && !USER_ROLES.includes('ROLE_SA')){
layer.msg('没有权限');
return;
}
if (basicData.reviewStatus == ReviewStatus.PASS || basicData.reviewStatus == ReviewStatus.SUBMITTED) { if (basicData.reviewStatus == ReviewStatus.PASS || basicData.reviewStatus == ReviewStatus.SUBMITTED) {
addDataConfirm(open); addDataConfirm(open);
} else { } else {

@ -27,6 +27,14 @@
if (!publicKey || publicKey == 'null' || publicKey != newPublicKey) { if (!publicKey || publicKey == 'null' || publicKey != newPublicKey) {
sessionStorage.setItem('javaPublicKey', newPublicKey); sessionStorage.setItem('javaPublicKey', newPublicKey);
} }
const USER_ROLE_LIST = /*[[${userRoles}]]*/ [];
const USER_ROLES = [];
if(USER_ROLE_LIST.length > 0){
for(const role of USER_ROLE_LIST){
USER_ROLES.push(role.roleName);
}
}
</script> </script>
<!-- 引入公用库 --> <!-- 引入公用库 -->