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

fix: fix privilege group list and list collections #38684

Merged
merged 1 commit into from
Dec 25, 2024

Conversation

shaoting-huang
Copy link
Contributor

related: #37031

  • built-in privilege group privileges in listPrivilegeGroups() should be the same as in milvus.yaml
  • collections granted by collection level built-in privilege group should be list in showCollections()

@sre-ci-robot sre-ci-robot added the size/S Denotes a PR that changes 10-29 lines. label Dec 24, 2024
@mergify mergify bot added dco-passed DCO check passed. kind/bug Issues or changes related a bug labels Dec 24, 2024
Copy link
Contributor

mergify bot commented Dec 24, 2024

@shaoting-huang go-sdk check failed, comment rerun go-sdk can trigger the job again.

Copy link

codecov bot commented Dec 24, 2024

Codecov Report

Attention: Patch coverage is 98.24561% with 1 line in your changes missing coverage. Please review.

Project coverage is 81.08%. Comparing base (05d9f85) to head (02ca794).
Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
pkg/util/paramtable/rbac_param.go 98.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #38684       +/-   ##
===========================================
+ Coverage   69.33%   81.08%   +11.74%     
===========================================
  Files         292     1381     +1089     
  Lines       26187   195243   +169056     
===========================================
+ Hits        18158   158310   +140152     
- Misses       8029    31343    +23314     
- Partials        0     5590     +5590     
Components Coverage Δ
Client 78.26% <ø> (∅)
Core 69.33% <ø> (ø)
Go 83.07% <98.24%> (∅)
Files with missing lines Coverage Δ
internal/rootcoord/root_coord.go 87.75% <100.00%> (ø)
internal/rootcoord/show_collection_task.go 100.00% <100.00%> (ø)
pkg/util/constant.go 96.82% <ø> (ø)
pkg/util/paramtable/rbac_param.go 99.23% <98.00%> (ø)

... and 1085 files with indirect coverage changes

@shaoting-huang
Copy link
Contributor Author

shaoting-huang commented Dec 24, 2024

after fix:

>>> role.list_grants()
GrantInfo groups:
- GrantItem: <object:Global>, <object_name:*>, <db_name:*>, <role_name:role>, <grantor_name:root>, <privilege:CreatePrivilegeGroup>
>>> client = MilvusClient(uri="http://localhost:19530", user="user1", password="Milvus")
>>> client.list_collections()
[]
>>> client = MilvusClient(uri="http://localhost:19530", user="root", password="Milvus")
>>> role.grant_v2("CollectionAdmin", "col2")
>>> role.list_grants()
GrantInfo groups:
- GrantItem: <object:Global>, <object_name:*>, <db_name:*>, <role_name:role>, <grantor_name:root>, <privilege:CreatePrivilegeGroup>
- GrantItem: <object:Global>, <object_name:col2>, <db_name:default>, <role_name:role>, <grantor_name:root>, <privilege:CollectionAdmin>
>>> client = MilvusClient(uri="http://localhost:19530", user="user1", password="Milvus")
>>> client.list_collections()
[]
>>> client = MilvusClient(uri="http://localhost:19530", user="root", password="Milvus")
>>> role.grant_v2("CollectionAdmin", "col1")
>>> role.revoke_v2("CollectionAdmin", "col2")
>>> role.list_grants()
GrantInfo groups:
- GrantItem: <object:Global>, <object_name:*>, <db_name:*>, <role_name:role>, <grantor_name:root>, <privilege:CreatePrivilegeGroup>
- GrantItem: <object:Global>, <object_name:col1>, <db_name:default>, <role_name:role>, <grantor_name:root>, <privilege:CollectionAdmin>
>>> client = MilvusClient(uri="http://localhost:19530", user="user1", password="Milvus")
>>> client.list_collections()
['col1']

@sre-ci-robot sre-ci-robot added size/M Denotes a PR that changes 30-99 lines. and removed size/S Denotes a PR that changes 10-29 lines. labels Dec 24, 2024
Copy link
Contributor

mergify bot commented Dec 24, 2024

@shaoting-huang E2e jenkins job failed, comment /run-cpu-e2e can trigger the job again.

@sre-ci-robot sre-ci-robot added area/test sig/testing size/L Denotes a PR that changes 100-499 lines. test/integration integration test and removed size/M Denotes a PR that changes 30-99 lines. labels Dec 24, 2024
Copy link
Contributor

mergify bot commented Dec 24, 2024

@shaoting-huang E2e jenkins job failed, comment /run-cpu-e2e can trigger the job again.

Copy link
Contributor

mergify bot commented Dec 24, 2024

@shaoting-huang go-sdk check failed, comment rerun go-sdk can trigger the job again.

Copy link
Contributor

@tedxu tedxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

return lo.Keys(builtinPrivilegeGroups)
}

func (p *rbacConfig) IsCollectionPrivilegeGroup(privName string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it is unusual to write implementation details in configuration declarations.

@sre-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: shaoting-huang, tedxu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

mergify bot commented Dec 25, 2024

@shaoting-huang go-sdk check failed, comment rerun go-sdk can trigger the job again.

Copy link
Contributor

mergify bot commented Dec 25, 2024

@shaoting-huang E2e jenkins job failed, comment /run-cpu-e2e can trigger the job again.

@shaoting-huang
Copy link
Contributor Author

/run-cpu-e2e

@tedxu
Copy link
Contributor

tedxu commented Dec 25, 2024

/lgtm

@mergify mergify bot added the ci-passed label Dec 25, 2024
@sre-ci-robot sre-ci-robot merged commit 6bc7990 into milvus-io:master Dec 25, 2024
20 checks passed
sre-ci-robot pushed a commit that referenced this pull request Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/test ci-passed dco-passed DCO check passed. kind/bug Issues or changes related a bug lgtm sig/testing size/L Denotes a PR that changes 100-499 lines. test/integration integration test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants