Skip to content

Commit

Permalink
MDEV-9443: Add REVOKE <role> as a command to PREPARE
Browse files Browse the repository at this point in the history
  • Loading branch information
cvicentiu committed Mar 22, 2016
1 parent c4bef7a commit 287f2d2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mysql-test/suite/roles/prepare_stmt_with_role.result
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ Grants for test_user@%
GRANT developers TO 'test_user'@'%'
GRANT USAGE ON *.* TO 'test_user'@'%'
#
# Test revoking a role.
#
SET @revokeRole = 'REVOKE developers FROM test_user';
PREPARE stmtRevokeRole FROM @revokeRole;
EXECUTE stmtRevokeRole;
SHOW GRANTS FOR test_user;
Grants for test_user@%
GRANT USAGE ON *.* TO 'test_user'@'%'
#
# Now drop the role.
#
SET @dropRole = 'DROP ROLE developers';
Expand Down
9 changes: 9 additions & 0 deletions mysql-test/suite/roles/prepare_stmt_with_role.test
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ EXECUTE stmtGrantRole;
SELECT * FROM mysql.roles_mapping;
SHOW GRANTS FOR test_user;

--echo #
--echo # Test revoking a role.
--echo #
SET @revokeRole = 'REVOKE developers FROM test_user';
PREPARE stmtRevokeRole FROM @revokeRole;
EXECUTE stmtRevokeRole;

SHOW GRANTS FOR test_user;

--echo #
--echo # Now drop the role.
--echo #
Expand Down
1 change: 1 addition & 0 deletions sql/sql_prepare.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2465,6 +2465,7 @@ static bool check_prepared_statement(Prepared_statement *stmt)
case SQLCOM_GRANT:
case SQLCOM_GRANT_ROLE:
case SQLCOM_REVOKE:
case SQLCOM_REVOKE_ROLE:
case SQLCOM_KILL:
case SQLCOM_COMPOUND:
case SQLCOM_SHUTDOWN:
Expand Down

0 comments on commit 287f2d2

Please sign in to comment.