From 5e1e5a8cb4bf2e5abc3356727288373a55655944 Mon Sep 17 00:00:00 2001 From: "peng.peng" Date: Fri, 3 Nov 2023 09:38:50 +0800 Subject: [PATCH 1/4] =?UTF-8?q?(*)=E8=B5=84=E6=BA=90=E6=A3=80=E7=B4=A2?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/auth/index.js | 1 + .../lib/controllers/metadataSearch/index.js | 19 ++++++++++++++++--- api/app/lib/index.js | 3 ++- .../resourceRetrieval/containers/retrieval.js | 16 ++++++++++------ 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/api/app/lib/controllers/auth/index.js b/api/app/lib/controllers/auth/index.js index ac242fd..1727601 100644 --- a/api/app/lib/controllers/auth/index.js +++ b/api/app/lib/controllers/auth/index.js @@ -56,6 +56,7 @@ async function login(ctx, next) { // await transaction.commit(); } catch (error) { // await transaction.rollback(); + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; ctx.body = { message: typeof error == 'string' ? error : '登录失败' diff --git a/api/app/lib/controllers/metadataSearch/index.js b/api/app/lib/controllers/metadataSearch/index.js index 9832f1d..edebd92 100644 --- a/api/app/lib/controllers/metadataSearch/index.js +++ b/api/app/lib/controllers/metadataSearch/index.js @@ -15,6 +15,14 @@ function searchMeta(opts) { where['$or'] = [{ name: { $iLike: `%${keywords}%` } } ] } + const resourceCatalogOrganization = { + model: models.ResourceCatalog, + attributes: ['id', 'name'], + include: [{ + model: models.Organization, + attributes: ['id', 'name'], + }] + } const findObj = { include: [ { @@ -22,7 +30,9 @@ function searchMeta(opts) { include: [{ model: models.Tag, }] - }], + }, + resourceCatalogOrganization + ], where: { ...where, type: { $in: ['表', '库'] } @@ -35,7 +45,9 @@ function searchMeta(opts) { include: [{ model: models.Tag, }] - }], + }, + resourceCatalogOrganization + ], where: where } const findObj3 = { @@ -45,7 +57,8 @@ function searchMeta(opts) { include: [{ model: models.Tag, }] - }], + }, + ], where: where } diff --git a/api/app/lib/index.js b/api/app/lib/index.js index 9c0f409..14424bc 100644 --- a/api/app/lib/index.js +++ b/api/app/lib/index.js @@ -110,6 +110,7 @@ module.exports.models = function (dc) { MetadataDatabase.belongsTo(ResourceCatalog, { foreignKey: 'catalog', targetKey: 'id' }); RestfulApi.belongsTo(ResourceCatalog, { foreignKey: 'catalog', targetKey: 'id' }); - + MetadataFile.belongsTo(ResourceCatalog, { foreignKey: 'catalog', targetKey: 'id' }); + ResourceCatalog.belongsTo(Organization, { foreignKey: 'orgId', targetKey: 'id' }); }; diff --git a/web/client/src/sections/resourceRetrieval/containers/retrieval.js b/web/client/src/sections/resourceRetrieval/containers/retrieval.js index 9f99eed..38f7846 100644 --- a/web/client/src/sections/resourceRetrieval/containers/retrieval.js +++ b/web/client/src/sections/resourceRetrieval/containers/retrieval.js @@ -201,15 +201,19 @@ function Retrieval(props) {
相关操作: { window.open(`/metadataManagement/latestMetadata?type=${METADTA_TYPE[s.type]}&treeId=${s?.catalog}&resourceId=${s.id}&catalogKey=${s.catalogKey}`) }}>定位 {s?.type == '表' || s?.type == '文件' ? - user?.role == '数据消费者' ? + user?.username !== 'SuperAmin' ? { - const token = approveList?.rows?.find(x => x.resourceId == s.id)?.token - if (!token) { - message.warning('您暂未申请该数据资源,请先申请该数据资源') + const isOrgAdmin = user?.role == '系统管理员' && user?.orgId == s?.resourceCatalog?.organization?.id + if (isOrgAdmin) { + downloadData(s) } else { - setCurrentData(s) + const token = approveList?.rows?.find(x => x.resourceId == s.id)?.token + if (!token) { + message.warning('您暂未申请该数据资源,请先申请该数据资源') + } else { + setCurrentData(s) + } } - }}>下载 : { downloadData(s) }}>下载 : ''}
From d06aafc28045b635239a2a4bd08ea142972bf3e3 Mon Sep 17 00:00:00 2001 From: "peng.peng" Date: Fri, 3 Nov 2023 09:53:53 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=EF=BC=88*=EF=BC=89=E6=9C=BA=E6=9E=84?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=A8=A1=E5=9D=97=E6=9D=83=E9=99=90?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/backups/nav-item.js | 2 +- web/client/src/sections/memberManagement/nav-item.js | 2 +- web/client/src/sections/metadataAcquisition/nav-item.js | 2 +- web/client/src/sections/metadataManagement/nav-item.js | 8 ++++---- web/client/src/sections/organization/nav-item.js | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/web/client/src/sections/backups/nav-item.js b/web/client/src/sections/backups/nav-item.js index 0b80f0a..fc6b81c 100644 --- a/web/client/src/sections/backups/nav-item.js +++ b/web/client/src/sections/backups/nav-item.js @@ -7,7 +7,7 @@ const SubMenu = Menu.SubMenu; export function getNavItem(user) { return ( - user?.role == '系统管理员' && } title='数据备份恢复'> + user?.username == 'SuperAdmin' && } title='数据备份恢复'> 备份恢复 diff --git a/web/client/src/sections/memberManagement/nav-item.js b/web/client/src/sections/memberManagement/nav-item.js index 56c3fd0..baa19f7 100644 --- a/web/client/src/sections/memberManagement/nav-item.js +++ b/web/client/src/sections/memberManagement/nav-item.js @@ -7,7 +7,7 @@ const SubMenu = Menu.SubMenu; export function getNavItem(user) { return ( - user?.role == '系统管理员' && } key="auth"> + user?.username == 'SuperAdmin' && } key="auth"> 用户管理 // user?.role == '系统管理员' && } title='用户管理'> diff --git a/web/client/src/sections/metadataAcquisition/nav-item.js b/web/client/src/sections/metadataAcquisition/nav-item.js index 1d9a4a9..d30281b 100644 --- a/web/client/src/sections/metadataAcquisition/nav-item.js +++ b/web/client/src/sections/metadataAcquisition/nav-item.js @@ -6,7 +6,7 @@ const SubMenu = Menu.SubMenu; export function getNavItem(user) { return ( - user?.role == '系统管理员' && } title='元数据采集'> + user?.username == 'SuperAdmin' && } title='元数据采集'> 适配器管理 diff --git a/web/client/src/sections/metadataManagement/nav-item.js b/web/client/src/sections/metadataManagement/nav-item.js index 7189721..f399c2c 100644 --- a/web/client/src/sections/metadataManagement/nav-item.js +++ b/web/client/src/sections/metadataManagement/nav-item.js @@ -15,12 +15,12 @@ export function getNavItem(user) { 业务元数据管理 - + {user?.username == 'SuperAdmin' && <> 模型管理 - - 标签管理 - + + 标签管理 + } } diff --git a/web/client/src/sections/organization/nav-item.js b/web/client/src/sections/organization/nav-item.js index 8bebc92..0514371 100644 --- a/web/client/src/sections/organization/nav-item.js +++ b/web/client/src/sections/organization/nav-item.js @@ -7,7 +7,7 @@ const SubMenu = Menu.SubMenu; export function getNavItem(user) { return ( - user?.role == '系统管理员' && } key="organization"> + user?.username == 'SuperAdmin' && } key="organization"> 机构管理 // user?.role == '系统管理员' && } title='用户管理'> From 200ae4a458b7f58aeb39c0c28c67106da953cafb Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Fri, 3 Nov 2023 13:48:25 +0800 Subject: [PATCH 3/4] =?UTF-8?q?(*)=20=E6=9C=80=E6=96=B0=E5=85=83=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=9D=83=E9=99=90=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../containers/databasesTable.js | 11 ++-- .../containers/filesTable.js | 8 +-- .../containers/latestMetadata.js | 60 +++++++++++-------- .../containers/metadataDetails.js | 4 +- .../containers/metadataTab.js | 8 +-- .../containers/restapisTable.js | 8 +-- 6 files changed, 55 insertions(+), 44 deletions(-) diff --git a/web/client/src/sections/metadataManagement/containers/databasesTable.js b/web/client/src/sections/metadataManagement/containers/databasesTable.js index 8f3b569..2099041 100644 --- a/web/client/src/sections/metadataManagement/containers/databasesTable.js +++ b/web/client/src/sections/metadataManagement/containers/databasesTable.js @@ -11,7 +11,7 @@ import MetadataResourceModal from '../components/metadataResourceModal'; import ReleaseModal from '../components/releaseModal'; const DatabaseTable = (props) => { - const { user, dispatch, actions, clientHeight, resourceCatalogId, resourceCatalogKey, + const { user, dispatch, actions, clientHeight, resourceCatalogId, resourceCatalogKey, isAdmin, resourceCatalogPath, isRequesting, metadataModels, setView, tagList, metadataResourceApplications, params } = props; const { metadataManagement } = actions; const SortValues = { 'ascend': 'asc', 'descend': 'desc' }; @@ -182,7 +182,7 @@ const DatabaseTable = (props) => { ra.applyBy == user.id && ra.resourceName === record.name && ra.resourceId == record.id); return onView(record)}>查看 - {user.role == '数据消费者' ? null : + {!isAdmin ? null : <> onEdit(record)}>编辑 { {record.type === '表' ? marking(record.id)}>打标 : null} } - - {user.role !== '数据消费者' ? null : record.type === '表' ? resourceApplicationsRecords.length === 0 ? + {isAdmin ? null : record.type === '表' ? resourceApplicationsRecords.length === 0 ? applyResources(record)}>申请资源 : 申请资源 : null} - {user.role == '数据消费者' ? null : + {!isAdmin ? null : record.type === '表' ? servicePublication(record)}>REST服务发布 : null } @@ -272,7 +271,7 @@ const DatabaseTable = (props) => { return - {user.role == '数据消费者' ? null : <> + {!isAdmin ? null : <> } { : + match={match} + isAdmin={isAdmin} /> : // { - const { user, actions, dispatch, clientHeight, metadataModels, isRequesting, resourceCatalogPath, match } = props; + const { user, actions, dispatch, clientHeight, metadataModels, isRequesting, resourceCatalogPath, match, isAdmin } = props; const { metadataManagement } = actions; const [activeKey, setActiveKey] = useState('info'); const [databasesRecord, setDatabasesRecord] = useState(null); @@ -108,7 +108,7 @@ const MetadataDetails = (props) => { return databasesRecord && (ConfigurableTypes['表'].includes(databasesRecord.type) || databasesRecord.type === '视图') ? null :
- {user?.role == '系统管理员' && } diff --git a/web/client/src/sections/metadataManagement/containers/metadataTab.js b/web/client/src/sections/metadataManagement/containers/metadataTab.js index a79a43d..ed61f76 100644 --- a/web/client/src/sections/metadataManagement/containers/metadataTab.js +++ b/web/client/src/sections/metadataManagement/containers/metadataTab.js @@ -7,7 +7,7 @@ import RestapisTable from './restapisTable'; import { push } from 'react-router-redux'; const MetadataTab = (props) => { - const { resourceCatalogId, resourceCatalogKey, resourceCatalogPath, actions, dispatch, params } = props; + const { resourceCatalogId, resourceCatalogKey, resourceCatalogPath, actions, dispatch, params, isAdmin } = props; const [activeKey, setActiveKey] = useState(params?.type || 'databases'); useEffect(() => { if (!params?.type) @@ -42,11 +42,11 @@ const MetadataTab = (props) => { { activeKey === 'databases' && resourceCatalogId ? : + resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} setView={onView} isAdmin={isAdmin} /> : activeKey === 'files' && resourceCatalogId ? : + resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} isAdmin={isAdmin} /> : activeKey === 'restapis' && resourceCatalogId ? < RestapisTable params={params} resourceCatalogId={resourceCatalogId} - resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} /> : null + resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} isAdmin={isAdmin} /> : null }
} diff --git a/web/client/src/sections/metadataManagement/containers/restapisTable.js b/web/client/src/sections/metadataManagement/containers/restapisTable.js index 7824a79..a8cea8b 100644 --- a/web/client/src/sections/metadataManagement/containers/restapisTable.js +++ b/web/client/src/sections/metadataManagement/containers/restapisTable.js @@ -8,7 +8,7 @@ import MetadataResourceModal from '../components/metadataResourceModal'; const RestapisTable = (props) => { const { user, dispatch, actions, clientHeight, resourceCatalogId, resourceCatalogKey, - isRequesting, metadataModels, tagList, metadataResourceApplications, params } = props; + isRequesting, metadataModels, tagList, metadataResourceApplications, params, isAdmin } = props; const { metadataManagement } = actions; const [tableData, setTableData] = useState([]); const [tableDataCount, setTableDataCount] = useState(0);//Table数据 @@ -143,7 +143,7 @@ const RestapisTable = (props) => { let resourceApplicationsRecords = metadataResourceApplications.filter(ra => ra.applyBy == user.id && ra.resourceName === record.name && ra.resourceId == record.id && !!record.token); return - {user.role == '数据消费者' ? null : + {!isAdmin ? null : <> onEdit(record)}>编辑 { } - {user.role == '系统管理员' ? '' : resourceApplicationsRecords.length === 0 ? + {isAdmin ? '' : resourceApplicationsRecords.length === 0 ? applyResources(record)}>申请资源 : 申请资源} @@ -187,7 +187,7 @@ const RestapisTable = (props) => { return - {user.role == '数据消费者' ? null : <>