Implement split_grants() instead of split(',', $grants) to handle spliting grants with column-level privs.

This commit is contained in:
Daniel Nichter
2012-10-31 14:20:43 -06:00
parent 0453d7dd82
commit 0fd9239500
5 changed files with 81 additions and 7 deletions

View File

@@ -101,13 +101,33 @@ diag(`/tmp/12345/use -u root -e "GRANT SELECT(city_id), INSERT(city) ON sakila.c
ok(
no_diff(
sub { pt_show_grants::main('-F', $cnf, qw(--only sally)) },
sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header)) },
"t/pt-show-grants/samples/column-grants.txt",
stderr => 1,
),
"Column-level grants (bug 866075)"
);
ok(
no_diff(
sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header),
qw(--separate)) },
"t/pt-show-grants/samples/column-grants-separate.txt",
stderr => 1,
),
"Column-level grants --separate (bug 866075)"
);
ok(
no_diff(
sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header),
qw(--separate --revoke)) },
"t/pt-show-grants/samples/column-grants-separate-revoke.txt",
stderr => 1,
),
"Column-level grants --separate --revoke (bug 866075)"
);
diag(`/tmp/12345/use -u root -e "DROP USER 'sally'\@'%'"`);
# #############################################################################

View File

@@ -0,0 +1,10 @@
-- Revoke statements for 'sally'@'%'
REVOKE INSERT (city) ON `sakila`.`city` FROM 'sally'@'%';
REVOKE SELECT (SANumber, DateCreated, PaymentStat, PckPrice) ON `test`.`t` FROM 'sally'@'%';
REVOKE SELECT (city_id) ON `sakila`.`city` FROM 'sally'@'%';
REVOKE USAGE ON *.* FROM 'sally'@'%';
-- Grants for 'sally'@'%'
GRANT INSERT (city) ON `sakila`.`city` TO 'sally'@'%';
GRANT SELECT (SANumber, DateCreated, PaymentStat, PckPrice) ON `test`.`t` TO 'sally'@'%';
GRANT SELECT (city_id) ON `sakila`.`city` TO 'sally'@'%';
GRANT USAGE ON *.* TO 'sally'@'%';

View File

@@ -0,0 +1,5 @@
-- Grants for 'sally'@'%'
GRANT INSERT (city) ON `sakila`.`city` TO 'sally'@'%';
GRANT SELECT (SANumber, DateCreated, PaymentStat, PckPrice) ON `test`.`t` TO 'sally'@'%';
GRANT SELECT (city_id) ON `sakila`.`city` TO 'sally'@'%';
GRANT USAGE ON *.* TO 'sally'@'%';

View File

@@ -1 +1,4 @@
--
-- Grants for 'sally'@'%'
GRANT INSERT (city), SELECT (city_id) ON `sakila`.`city` TO 'sally'@'%';
GRANT SELECT (SANumber, DateCreated, PaymentStat, PckPrice) ON `test`.`t` TO 'sally'@'%';
GRANT USAGE ON *.* TO 'sally'@'%';