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

privilege: fix compatibility of DBIsVisible (#14862) #14939

Merged
merged 3 commits into from
Mar 14, 2020

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented Feb 25, 2020

cherry-pick #14862 to release-3.0


What problem does this PR solve?

User with trigger/references/execute global privileges can not see all database names and use them, but in MySQL is okay.

in TiDB:

mysql [email protected]:(none)> show grants;
+-----------------------------------------------------+
| Grants for User                                     |
+-----------------------------------------------------+
| GRANT References,Execute,Trigger ON *.* TO 'u1'@'%' |
+-----------------------------------------------------+
1 row in set
Time: 0.014s
mysql [email protected]:(none)> show databases;
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
+--------------------+
1 row in set

in MySQL:

mysql [email protected]:test> show grants;
+----------------------------------+
| Grants for u1@%                  |
+----------------------------------+
| GRANT TRIGGER ON *.* TO 'u1'@'%' |
+----------------------------------+
1 row in set
Time: 0.014s
mysql [email protected]:test> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test               |
+--------------------+
5 rows in set
Time: 0.014s
mysql [email protected]:test> use test;
You are now connected to database "test" as user "u1"
Time: 0.001s
mysql [email protected]:test> show tables;
+----------------+
| Tables_in_test |
+----------------+
| Ata            |
| atA            |
+----------------+
2 rows in set
Time: 0.014s
mysql [email protected]:test>

mysql [email protected]:test> show grants;
+----------------------------------+
| Grants for u1@%                  |
+----------------------------------+
| GRANT EXECUTE ON *.* TO 'u1'@'%' |
+----------------------------------+
1 row in set
Time: 0.015s
mysql [email protected]:test> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test               |
+--------------------+
5 rows in set

What is changed and how it works?

add TriggerPriv, EcecutePriv, ReferencePriv into globalDBVisible

Check List

Tests

  • Unit test

Code changes

  • None

Side effects

  • None

Related changes

  • Need to cherry-pick to the release branch

Release note

@sre-bot
Copy link
Contributor Author

sre-bot commented Feb 25, 2020

/run-all-tests

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao added the status/LGT2 Indicates that a PR has LGTM 2. label Feb 26, 2020
@ngaut ngaut added the status/can-merge Indicates a PR has been approved by a committer. label Feb 27, 2020
@zz-jason
Copy link
Member

/merge

@sre-bot
Copy link
Contributor Author

sre-bot commented Mar 14, 2020

Your auto merge job has been accepted, waiting for 15365

@sre-bot
Copy link
Contributor Author

sre-bot commented Mar 14, 2020

/run-all-tests

@sre-bot sre-bot merged commit 7026c86 into pingcap:release-3.0 Mar 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/privilege status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants