[MDEV-22346] Adding example for SET DEFAULT ROLE documentation Created: 2020-04-22  Updated: 2020-04-22  Resolved: 2020-04-22

Status: Closed
Project: MariaDB Server
Component/s: Authentication and Privilege System, Documentation
Affects Version/s: None
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Anel Husakovic Assignee: Ian Gilfillan
Resolution: Fixed Votes: 0
Labels: None


 Description   

I think that set-default-role may have better example and a context, with adding note that default_role as each role should be granted first (in second paragraph) to the user in order to have effect.
Example could be:

CREATE ROLE test_role;
CREATE USER test_user;
SET DEFAULT ROLE test_role FOR test_user; #error, role not granted
GRANT test_role TO test_user; # ok
SET DEFAULT ROLE test_role FOR test_user;
# Get list of roles
SELECT * FROM mysql.roles_mapping;
# Or from mysql.user where default_role=Y
SELECT * FROM mysql.user where default_role='Y';


Generated at Thu Feb 08 09:14:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.