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

Add the support of GRANT PRIVILEGE #24

Merged
merged 4 commits into from
Nov 3, 2023

Conversation

git-hulk
Copy link
Member

@git-hulk git-hulk commented Nov 3, 2023

This closes #18

@coveralls
Copy link

coveralls commented Nov 3, 2023

Pull Request Test Coverage Report for Build 6743550597

  • 124 of 396 (31.31%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.6%) to 58.205%

Changes Missing Coverage Covered Lines Changed/Added Lines %
parser/parser_common.go 12 14 85.71%
parser/ast.go 29 48 60.42%
parser/parse_system.go 81 332 24.4%
Totals Coverage Status
Change from base Build 6733863258: -1.6%
Covered Lines: 4150
Relevant Lines: 7130

💛 - Coveralls

@git-hulk git-hulk requested a review from Lance726 November 3, 2023 09:35
@git-hulk
Copy link
Member Author

git-hulk commented Nov 3, 2023

@Lance726 I don't add enough test sql tests since cannot find more cases, may add more later.

@git-hulk git-hulk marked this pull request as draft November 3, 2023 09:36
@Lance726
Copy link
Collaborator

Lance726 commented Nov 3, 2023

@Lance726 I don't add enough test sql tests since cannot find more cases, may add more later.

ok~

@git-hulk git-hulk force-pushed the feature/grant-privilege branch from fb790d2 to 228b39d Compare November 3, 2023 09:40
@git-hulk git-hulk marked this pull request as ready for review November 3, 2023 09:40
@git-hulk git-hulk merged commit 33d0c89 into AfterShip:master Nov 3, 2023
@git-hulk
Copy link
Member Author

git-hulk commented Nov 3, 2023

@orginux Can have a try if you like.

@orginux
Copy link
Contributor

orginux commented Nov 3, 2023

I would suggest adding the ALL keyword:

 GRANT ALL ON *.* TO admin_role WITH GRANT OPTION;

@git-hulk
Copy link
Member Author

git-hulk commented Nov 3, 2023

I would suggest adding the ALL keyword:

 GRANT ALL ON *.* TO admin_role WITH GRANT OPTION;

Thank you, done in 57ca48c

@orginux
Copy link
Contributor

orginux commented Nov 3, 2023

Great, thanks for the quick response and solving.
I found another issue, ClickHouse you can provide GRAND without parameters to have access to all columns in a table, for example:

GRANT SELECT ON database.table_1 TO table_1_select_role;
GRANT INSERT ON database.table_2 TO table_2_insert_role;

but currently, the parser supports only grants with parameters.

@orginux
Copy link
Contributor

orginux commented Nov 3, 2023

It should also be possible to submit multiple grants in a single query:

GRANT SELECT, dictGet ON *.*  TO select_all_role;

@git-hulk
Copy link
Member Author

git-hulk commented Nov 3, 2023

@orginux Yes, those are missing keywords in GRANT PRIVILEGE and now have been fixed.

@git-hulk git-hulk deleted the feature/grant-privilege branch November 29, 2024 08:52
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.

Add the support of GRANT expression
4 participants