Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 新增审计系统 #782

Merged
merged 59 commits into from
Aug 28, 2023
Merged

feat: 新增审计系统 #782

merged 59 commits into from
Aug 28, 2023

Conversation

ZihanChen821
Copy link
Contributor

@ZihanChen821 ZihanChen821 commented Aug 4, 2023

改动

scow节点新增audit-server服务

  1. 新增audit-server服务,供portal-web和mis-web调用记录日志和查看日志功能
  2. 新增audit-db服务,供audit-server服务储存和查看操作日志

image

数据库信息
databaseName: scow_audit
tableName: operation_log
table desc:

image

其中metaData里根据每种操作类型的不同,以json形式储存了不同的字段,供操作内容展示。

  1. scow-cli增加以上服务部署,在/config/audit.yaml中配置是否部署此服务以及该服务的db和url
# 审计服务的url,默认不修改
url: audit-server:5000

# 审计系统数据库的信息
db:
  host: audit-db
  port: 3306
  user: root
  dbName: scow-audit
  1. mis-web在用户空间,账户管理,租户管理,平台管理各增加操作日志页面,其中的展示逻辑如
    4.1 用户空间展示的是所有operatorUserId 等于该用户的操作日志
    4.2 账户管理展示的是所有保存了targetAccountName且与该账户名相等的操作日志
    4.3 租户管理展示的是该租户下所有用户和operatorUserId相等的操作日志
    4.4 平台管理展示的是所有操作日志
    4.5 所有页面可筛选操作行为,操作时间,操作结果, 账户租户和平台的操作日志还能搜索操作者。
    4.6 如果没有配置审计系统,则操作日志路由不展示。门户系统和管理系统将不会记录操作日志。

image

image

关于操作行为的枚举以及对应的操作码和操作详情展示格式记录在该文档附录:

https://jgf29kqp7z.feishu.cn/wiki/G30hwOvOJiJhWIk3mxIcen2snUe

ps: 是否需要新增一篇blog 通知用户该新功能改动?

@changeset-bot
Copy link

changeset-bot bot commented Aug 4, 2023

🦋 Changeset detected

Latest commit: 02d1eab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@scow/grpc-api Minor
@scow/config Minor
@scow/lib-operation-log Minor
@scow/audit-server Minor
@scow/protos Minor
@scow/portal-web Minor
@scow/demo-vagrant Minor
@scow/mis-web Minor
@scow/cli Minor
@scow/docs Minor
@scow/lib-hook Patch
@scow/auth Minor
@scow/mis-server Minor
@scow/portal-server Minor
@scow/lib-scheduler-adapter Patch
@scow/gateway Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ZihanChen821 ZihanChen821 force-pushed the feat-opeation-log-server branch from 70a7003 to c4f8bef Compare August 4, 2023 06:02
@ZihanChen821 ZihanChen821 force-pushed the feat-opeation-log-server branch from c4f8bef to 92c8605 Compare August 4, 2023 09:12
@codecov
Copy link

codecov bot commented Aug 4, 2023

Codecov Report

Patch coverage: 84.61% and project coverage change: -0.02% ⚠️

Comparison is base (ffefb17) 70.69% compared to head (02d1eab) 70.68%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #782      +/-   ##
==========================================
- Coverage   70.69%   70.68%   -0.02%     
==========================================
  Files         126      129       +3     
  Lines        3617     3643      +26     
  Branches      466      479      +13     
==========================================
+ Hits         2557     2575      +18     
- Misses        974      976       +2     
- Partials       86       92       +6     
Files Changed Coverage Δ
apps/cli/src/config/install.ts 100.00% <ø> (ø)
apps/audit-server/src/utils/operationLogs.ts 56.25% <56.25%> (ø)
...t-server/src/migrations/Migration20230817054947.ts 75.00% <75.00%> (ø)
apps/cli/src/compose/index.ts 77.46% <75.00%> (-0.32%) ⬇️
apps/audit-server/src/services/operationLog.ts 91.30% <91.30%> (ø)
apps/audit-server/src/config/audit.ts 100.00% <100.00%> (ø)
apps/audit-server/src/entities/OperationLog.ts 100.00% <100.00%> (ø)
apps/audit-server/tests/utils/helpers.ts 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tongchong tongchong requested review from ddadaal and removed request for ddadaal August 10, 2023 08:31
@ZihanChen821 ZihanChen821 changed the title feat: 新增operation log server feat: 新增审计系统 Aug 18, 2023
@ZihanChen821 ZihanChen821 marked this pull request as ready for review August 18, 2023 07:41
@ZihanChen821 ZihanChen821 requested a review from ddadaal August 18, 2023 07:41
apps/mis-web/src/pages/api/admin/changePassword.ts Outdated Show resolved Hide resolved
apps/portal-web/src/models/operationLog.ts Outdated Show resolved Hide resolved
@ZihanChen821 ZihanChen821 requested a review from ddadaal August 22, 2023 05:42
@ddadaal
Copy link
Member

ddadaal commented Aug 22, 2023

我觉得可以进了,但是现在进的话1.0就会带这个功能。明天确认一下1.0要不要这个功能。

@ddadaal
Copy link
Member

ddadaal commented Aug 26, 2023

解决一下冲突

@ZihanChen821
Copy link
Contributor Author

解决一下冲突

已解决

@ddadaal ddadaal merged commit ee89b11 into master Aug 28, 2023
@ddadaal ddadaal deleted the feat-opeation-log-server branch August 28, 2023 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants