forked from github/dataease
refactor(应用): 应用管理增加权限控制
This commit is contained in:
parent
2b67bec9ab
commit
e3529ee9b1
@ -86,7 +86,7 @@ public class DatasourceController {
|
||||
@PostMapping("/get/{id}")
|
||||
public DatasourceDTO getDatasource(@PathVariable String id) throws Exception {
|
||||
DatasourceUnionRequest request = new DatasourceUnionRequest();
|
||||
request.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
request.setUserId("1");
|
||||
request.setId(id);
|
||||
List<DatasourceDTO> datasourceList = datasourceService.getDatasourceList(request);
|
||||
return CollectionUtils.isNotEmpty(datasourceList) ? datasourceList.get(0) : null;
|
||||
|
@ -24,4 +24,10 @@ public class AppLogGridDTO extends PanelAppTemplateLog implements Serializable {
|
||||
|
||||
private Boolean deleteResource;
|
||||
|
||||
private String datasetPrivileges;
|
||||
|
||||
private String panelPrivileges;
|
||||
|
||||
private String datasourcePrivileges;
|
||||
|
||||
}
|
||||
|
@ -10,9 +10,17 @@
|
||||
<result column="panel_group_pid" property="panelGroupPid"/>
|
||||
<result column="dataset_group_pid" property="datasetGroupPid"/>
|
||||
<result column="datasource_type" property="datasourceType"/>
|
||||
<result column="dataset_privileges" property="datasetPrivileges"/>
|
||||
<result column="panel_privileges" property="panelPrivileges"/>
|
||||
<result column="datasource_privileges" property="datasourcePrivileges"/>
|
||||
</resultMap>
|
||||
<select id="query" parameterType="io.dataease.service.panel.applog.AppLogQueryParam" resultMap="BaseResultMapDTO">
|
||||
select * from
|
||||
select
|
||||
logInfo.*,
|
||||
get_auths(logInfo.dataset_group_id,'dataset',#{userId}) as `dataset_privileges`,
|
||||
get_auths(logInfo.panel_id,'panel',#{userId}) as `panel_privileges`,
|
||||
get_auths(logInfo.datasource_id,'link',#{userId}) as `datasource_privileges`
|
||||
from
|
||||
(select * from
|
||||
(SELECT
|
||||
panel_app_template_log.id,
|
||||
|
@ -7,5 +7,6 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AppLogQueryParam extends GridExample {
|
||||
private String userId;
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.dataease.service.panel.applog;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.controller.sys.request.KeyGridRequest;
|
||||
import io.dataease.dto.SysLogDTO;
|
||||
import io.dataease.dto.appTemplateMarket.AppLogGridDTO;
|
||||
@ -13,7 +14,6 @@ import io.dataease.service.panel.PanelGroupService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
@ -38,6 +38,7 @@ public class AppLogService {
|
||||
GridExample gridExample = request.convertExample();
|
||||
gridExample.setExtendCondition(request.getKeyWord());
|
||||
AppLogQueryParam logQueryParam = gson.fromJson(gson.toJson(gridExample), AppLogQueryParam.class);
|
||||
logQueryParam.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
List<AppLogGridDTO> voLogs = extAppLogMapper.query(logQueryParam);
|
||||
return voLogs;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ VALUES (41, 1, 1, 1, '应用管理', 'system-app-template', 'panel/appTemplate/i
|
||||
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`,
|
||||
`path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`,
|
||||
`update_time`)
|
||||
VALUES (203, 0, 0, 1, '应用市场', 'app-template-market', 'panel/appTemplateMarket/index', 6, 'dashboard',
|
||||
VALUES (203, 0, 0, 1, '应用', 'app-template-market', 'panel/appTemplateMarket/index', 6, 'dashboard',
|
||||
'/appTemplateMarket', 0, 0, 0, NULL, NULL, NULL, NULL, 1620444227389);
|
||||
|
||||
ALTER TABLE `dataset_table_field` CHANGE COLUMN `type` `type` VARCHAR(255) NOT NULL COMMENT '原始字段类型' ;
|
||||
@ -53,3 +53,17 @@ VALUES ('Apache Kylin 数据源插件', 'default', '0', '0', 'datasource', 'Apac
|
||||
|
||||
|
||||
INSERT INTO `sys_msg_channel` (`msg_channel_id`, `channel_name`, `service_name`) VALUES ('6', 'webmsg.channel_larksuite_msg', 'sendLarksuite');
|
||||
|
||||
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (204, 203, 0, 2, '删除记录', NULL, NULL, 999, NULL, NULL, 0, 0, 0, 'appLog:del', NULL, NULL, 1614930903502, 1614930903502);
|
||||
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (205, 203, 0, 2, '编辑记录', NULL, NULL, 999, NULL, NULL, 0, 0, 0, 'appLog:edit', NULL, NULL, 1614930935529, 1614930935529);
|
||||
|
||||
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`, `copy_from`, `copy_id`) VALUES ('46e4e2cb-1349-40c3-a72d-7b0b30ab5d14', '203', 'menu', '1', 'role', 1666840141866, NULL, 'admin', NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`, `copy_from`, `copy_id`) VALUES ('6e22ad53-d737-447f-9686-5041e122b4dc', '205', 'menu', '1', 'role', 1666840141468, NULL, 'admin', NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`, `copy_from`, `copy_id`) VALUES ('da17fcfe-7875-4aaf-983b-d750d71f36d2', '204', 'menu', '1', 'role', 1666840141658, NULL, 'admin', NULL, NULL, NULL);
|
||||
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('b4fe2e52-55a4-11ed-bf84-0242ac130005', '6e22ad53-d737-447f-9686-5041e122b4dc', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1666840141000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('b4fe3215-55a4-11ed-bf84-0242ac130005', '6e22ad53-d737-447f-9686-5041e122b4dc', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1666840141000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('b51affbf-55a4-11ed-bf84-0242ac130005', 'da17fcfe-7875-4aaf-983b-d750d71f36d2', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1666840141000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('b51b0473-55a4-11ed-bf84-0242ac130005', 'da17fcfe-7875-4aaf-983b-d750d71f36d2', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1666840141000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('b53a1ad7-55a4-11ed-bf84-0242ac130005', '46e4e2cb-1349-40c3-a72d-7b0b30ab5d14', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1666840142000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('b53a1dfd-55a4-11ed-bf84-0242ac130005', '46e4e2cb-1349-40c3-a72d-7b0b30ab5d14', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1666840142000, NULL, NULL, NULL);
|
||||
|
@ -66,13 +66,13 @@
|
||||
<el-row class="market-button-area">
|
||||
<el-button
|
||||
size="small"
|
||||
style="width: 48%"
|
||||
style="width: 45%"
|
||||
@click="templatePreview"
|
||||
>{{ $t('panel.preview') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
style="width: 48%"
|
||||
style="width: 45%"
|
||||
type="primary"
|
||||
@click="apply"
|
||||
>{{ $t('panel.apply') }}
|
||||
|
@ -40,7 +40,7 @@
|
||||
/>
|
||||
</el-row>
|
||||
<el-row
|
||||
v-show="marketActiveTab==='apply_logs'"
|
||||
v-if="marketActiveTab==='apply_logs'"
|
||||
class="main-log-area template-main"
|
||||
>
|
||||
<app-template-log class="log-area" />
|
||||
|
@ -86,6 +86,7 @@
|
||||
:class="[filterTexts.length ? 'table-container-filter' : '']"
|
||||
>
|
||||
<grid-table
|
||||
:ref="'grid-table'"
|
||||
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
|
||||
:table-data="data"
|
||||
:columns="[]"
|
||||
@ -101,7 +102,7 @@
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<span
|
||||
v-if="row.datasourceId"
|
||||
v-if="row.datasourceId && hasDataPermission('use',row.datasourcePrivileges)"
|
||||
class="link-span"
|
||||
@click="goToDatasource(row)"
|
||||
>{{ row.datasourceName }}</span>
|
||||
@ -120,7 +121,7 @@
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<span
|
||||
v-if="row.panelId"
|
||||
v-if="row.panelId && hasDataPermission('use',row.panelPrivileges)"
|
||||
class="link-span"
|
||||
@click="goPanel(row)"
|
||||
>{{ row.panelName }}</span>
|
||||
@ -143,6 +144,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="optShow"
|
||||
slot="__operation"
|
||||
:label="$t('commons.operating')"
|
||||
fixed="right"
|
||||
@ -150,7 +152,7 @@
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-permission="['user:edit']"
|
||||
v-permission="['appLog:edit']"
|
||||
class="de-text-btn mr2"
|
||||
type="text"
|
||||
@click="editApply(scope.row)"
|
||||
@ -158,7 +160,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.id !== 1"
|
||||
v-permission="['user:del']"
|
||||
v-permission="['appLog:del']"
|
||||
class="de-text-btn"
|
||||
type="text"
|
||||
@click="del(scope.row)"
|
||||
@ -189,7 +191,10 @@
|
||||
width="420px"
|
||||
>
|
||||
<el-row>
|
||||
<el-checkbox v-model="deleteItemInfo.deleteResource" />
|
||||
<el-checkbox
|
||||
v-model="deleteItemInfo.deleteResource"
|
||||
:disabled="!(hasDataPermission('manage',deleteItemInfo.panelPrivileges) &&hasDataPermission('manage',deleteItemInfo.datasetPrivileges) &&hasDataPermission('manage',deleteItemInfo.datasourcePrivileges))"
|
||||
/>
|
||||
{{ $t('app_template.log_resource_delete_tips') }}
|
||||
</el-row>
|
||||
<span slot="footer">
|
||||
@ -237,6 +242,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
optShow: false,
|
||||
deleteConfirmDialog: false,
|
||||
deleteItemInfo: {
|
||||
deleteResource: false
|
||||
@ -299,7 +305,10 @@ export default {
|
||||
datasetGroupPid: item.datasetGroupPid,
|
||||
datasetGroupId: item.datasetGroupId,
|
||||
datasetGroupName: item.datasetGroupName,
|
||||
panelName: item.panelName
|
||||
panelName: item.panelName,
|
||||
datasourcePrivileges: item.datasourcePrivileges,
|
||||
panelPrivileges: item.panelPrivileges,
|
||||
datasetPrivileges: item.datasetPrivileges
|
||||
}
|
||||
this.$refs.templateEditApply.init(param)
|
||||
},
|
||||
@ -416,6 +425,11 @@ export default {
|
||||
logGrid(currentPage, pageSize, param).then((response) => {
|
||||
this.data = response.data.listObject
|
||||
this.paginationConfig.total = response.data.itemCount
|
||||
const _this = this
|
||||
_this.optShow = false
|
||||
this.$nextTick(() => {
|
||||
_this.optShow = true
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -87,6 +87,7 @@
|
||||
>
|
||||
<treeselect
|
||||
v-model="attachForm.panelGroupPid"
|
||||
:disabled="!(formType === 'add' ? true : hasDataPermission('manage', outerParams.panelPrivileges))"
|
||||
:clearable="false"
|
||||
:options="panelGroupList"
|
||||
:normalizer="normalizer"
|
||||
@ -100,7 +101,10 @@
|
||||
:label="$t('app_template.panel_name')"
|
||||
prop="panelName"
|
||||
>
|
||||
<el-input v-model="attachForm.panelName" />
|
||||
<el-input
|
||||
v-model="attachForm.panelName"
|
||||
:disabled="!(formType === 'add' ? true : hasDataPermission('manage', outerParams.panelPrivileges))"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('app_template.dataset_group_position')"
|
||||
@ -108,6 +112,7 @@
|
||||
>
|
||||
<treeselect
|
||||
v-model="attachForm.datasetGroupPid"
|
||||
:disabled="!(formType === 'add' ? true : hasDataPermission('manage', outerParams.datasetPrivileges))"
|
||||
:clearable="false"
|
||||
:options="datasetGroupList"
|
||||
:normalizer="normalizer"
|
||||
@ -121,7 +126,10 @@
|
||||
:label="$t('app_template.dataset_group_name')"
|
||||
prop="datasetGroupName"
|
||||
>
|
||||
<el-input v-model="attachForm.datasetGroupName" />
|
||||
<el-input
|
||||
v-model="attachForm.datasetGroupName"
|
||||
:disabled="!(formType === 'add' ? true : hasDataPermission('manage', outerParams.panelPrivileges))"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@ -319,6 +327,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
appMarketEdit: true,
|
||||
attachRule: {
|
||||
panelName: [
|
||||
{
|
||||
@ -594,7 +603,8 @@ export default {
|
||||
id: this.outerParams.datasourceId,
|
||||
showModel: this.outerParams.showModel,
|
||||
type: this.outerParams.datasourceType,
|
||||
name: this.outerParams.name
|
||||
name: this.outerParams.name,
|
||||
privileges: this.outerParams.datasourcePrivileges
|
||||
}
|
||||
this.getPanelGroupTree()
|
||||
this.getDatasetGroupTree()
|
||||
|
Loading…
Reference in New Issue
Block a user