Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
29753fb9
Commit
29753fb9
authored
Mar 22, 2016
by
Vicențiu Ciorbaru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-9443: Add reexecution test cases.
parent
287f2d29
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
0 deletions
+60
-0
mysql-test/suite/roles/prepare_stmt_with_role.result
mysql-test/suite/roles/prepare_stmt_with_role.result
+36
-0
mysql-test/suite/roles/prepare_stmt_with_role.test
mysql-test/suite/roles/prepare_stmt_with_role.test
+24
-0
No files found.
mysql-test/suite/roles/prepare_stmt_with_role.result
View file @
29753fb9
...
...
@@ -20,12 +20,17 @@ Grants for root@localhost
GRANT developers TO 'root'@'localhost' WITH ADMIN OPTION
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
# Test reexecution.
EXECUTE stmtCreateRole;
ERROR HY000: Operation CREATE ROLE failed for 'developers'
#
# Now grant the role to the test user.
#
SET @grantRole = 'GRANT developers to test_user';
PREPARE stmtGrantRole FROM @grantRole;
EXECUTE stmtGrantRole;
# Test reexecution.
EXECUTE stmtGrantRole;
#
# We should see 2 entries in the roles_mapping table.
#
...
...
@@ -43,6 +48,17 @@ GRANT USAGE ON *.* TO 'test_user'@'%'
SET @revokeRole = 'REVOKE developers FROM test_user';
PREPARE stmtRevokeRole FROM @revokeRole;
EXECUTE stmtRevokeRole;
EXECUTE stmtRevokeRole;
ERROR HY000: Cannot revoke role 'developers' from: 'test_user'@'%'.
SHOW GRANTS FOR test_user;
Grants for test_user@%
GRANT USAGE ON *.* TO 'test_user'@'%'
EXECUTE stmtGrantRole;
SHOW GRANTS FOR test_user;
Grants for test_user@%
GRANT developers TO 'test_user'@'%'
GRANT USAGE ON *.* TO 'test_user'@'%'
EXECUTE stmtRevokeRole;
SHOW GRANTS FOR test_user;
Grants for test_user@%
GRANT USAGE ON *.* TO 'test_user'@'%'
...
...
@@ -67,5 +83,25 @@ GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
SHOW GRANTS FOR test_user;
Grants for test_user@%
GRANT USAGE ON *.* TO 'test_user'@'%'
#
# Test reexecution.
#
EXECUTE stmtCreateRole;
SELECT user, host,is_role FROM mysql.user
WHERE user = 'developers';
user host is_role
developers Y
SELECT * FROM mysql.roles_mapping;
Host User Role Admin_option
localhost root developers Y
SHOW GRANTS;
Grants for root@localhost
GRANT developers TO 'root'@'localhost' WITH ADMIN OPTION
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
SHOW GRANTS FOR test_user;
Grants for test_user@%
GRANT USAGE ON *.* TO 'test_user'@'%'
EXECUTE stmtDropRole;
# Cleanup.
DROP USER test_user;
mysql-test/suite/roles/prepare_stmt_with_role.test
View file @
29753fb9
...
...
@@ -18,12 +18,18 @@ SELECT user, host,is_role FROM mysql.user
WHERE
user
=
'developers'
;
SHOW
GRANTS
;
--
echo
# Test reexecution.
--
error
ER_CANNOT_USER
EXECUTE
stmtCreateRole
;
--
echo
#
--
echo
# Now grant the role to the test user.
--
echo
#
SET
@
grantRole
=
'GRANT developers to test_user'
;
PREPARE
stmtGrantRole
FROM
@
grantRole
;
EXECUTE
stmtGrantRole
;
--
echo
# Test reexecution.
EXECUTE
stmtGrantRole
;
--
echo
#
--
echo
# We should see 2 entries in the roles_mapping table.
...
...
@@ -38,7 +44,13 @@ SHOW GRANTS FOR test_user;
SET
@
revokeRole
=
'REVOKE developers FROM test_user'
;
PREPARE
stmtRevokeRole
FROM
@
revokeRole
;
EXECUTE
stmtRevokeRole
;
--
error
ER_CANNOT_REVOKE_ROLE
EXECUTE
stmtRevokeRole
;
SHOW
GRANTS
FOR
test_user
;
EXECUTE
stmtGrantRole
;
SHOW
GRANTS
FOR
test_user
;
EXECUTE
stmtRevokeRole
;
SHOW
GRANTS
FOR
test_user
;
--
echo
#
...
...
@@ -57,5 +69,17 @@ SELECT * FROM mysql.roles_mapping;
SHOW
GRANTS
;
SHOW
GRANTS
FOR
test_user
;
--
echo
#
--
echo
# Test reexecution.
--
echo
#
EXECUTE
stmtCreateRole
;
SELECT
user
,
host
,
is_role
FROM
mysql
.
user
WHERE
user
=
'developers'
;
SELECT
*
FROM
mysql
.
roles_mapping
;
SHOW
GRANTS
;
SHOW
GRANTS
FOR
test_user
;
EXECUTE
stmtDropRole
;
--
echo
# Cleanup.
DROP
USER
test_user
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment