Type:
Task
Priority:
Major
Resolution:
Fixed
Component/s:
None
Roles
As (or close to) defined in the SQL:2003 standard.
New statements
CREATE ROLE role
DROP ROLE role
GRANT role TO { user | user }
REVOKE role FROM {user | role }
SET ROLE { role_name | NONE }
According to the standard, role and user names live in the same namespace. But in MariaDB a user name has a mandatory @host part (even if it's @% ). And we probably wouldn't want it for roles. So, practically, we will have users and roles in different name spaces, with a little ambiguity, when a user name is specified without a @host part, where allowed. Alternatively, we can specify that a role name cannot match the first part of any user name. May be it'll be less confusing this way.
Only one role can be set to a user at any specific point in any given session. In other words, CURRENT_ROLE (see below) can never return a list.
Privileges
One needs CREATE USER privilege to create or drop a role. Or an appropriate (insert or delete) privilege on the mysql database.
One needs a role to be granted to himself WITH ADMIN OPTION to be able to grant or revoke it further. A creator of a role gets it automatically granted to himself WITH ADMIN CURRENT_USER . Alternatively, one can use WITH ADMIN CURRENT_ROLE or (with SUPER privilege) WITH ADMIN arbitrary_definer .
Existing statements need to work with roles
REVOKE privilege FROM { user | role }
GRANT privilege TO { user | role }
SHOW GRANTS FOR { user | role }
New functions
CURRENT_ROLE
CURRENT_ROLE()
If there is no current role, the function returns NULL , not "NONE" .
Informational tables
INFORMATION_SCHEMA.APPLICABLE_ROLES
INFORMATION_SCHEMA.ENABLED_ROLES
there are more tables in the INFORMATION_SCHEMA that are relevant for roles. They are not part of this task.
DEFINER=CURRENT_ROLE
Everywhere where one can write DEFINER=xxx , we should allow xxx to be a role name. And additionally we'll support DEFINER=CURRENT_ROLE .
Reserved role names
The role name of PUBLIC is reserved. There can be no role with this name. But this name can be used in GRANT and REVOKE statements as a grantee.Privileges granted to PUBLIC are always available to everyone. Implementing it is not part of this task.
The role name of NONE is reserved too.
Default role (not part of this task)
Syntax variants (which ones we'll do?):
CREATE USER xxx DEFAULT ROLE yyy;
ALTER USER xxx DEFAULT ROLE yyy;
SET DEFAULT ROLE yyy;
SET DEFAULT ROLE yyy [ FOR xxx ];
When a default role is set, the server implicitly runs SET ROLE yyy for every new connection (or after a COM_CHANGE_USER for a user xxx .
{"report":{"fcp":1204.8000001907349,"ttfb":353.2000002861023,"pageVisibility":"visible","entityId":23702,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"6839d4ae-18ff-4f8f-919b-4eabdc724232","navigationType":0,"readyForUser":1369.0999999046326,"redirectCount":0,"resourceLoadedEnd":1351,"resourceLoadedStart":364.5,"resourceTiming":[{"duration":231.2000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":364.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":364.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":595.7000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":231.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":364.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":364.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":596.2000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":290.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":365,"connectEnd":365,"connectStart":365,"domainLookupEnd":365,"domainLookupStart":365,"fetchStart":365,"redirectEnd":0,"redirectStart":0,"requestStart":365,"responseEnd":655.3000001907349,"responseStart":655.3000001907349,"secureConnectionStart":365},{"duration":386.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":365.2000002861023,"connectEnd":365.2000002861023,"connectStart":365.2000002861023,"domainLookupEnd":365.2000002861023,"domainLookupStart":365.2000002861023,"fetchStart":365.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":365.2000002861023,"responseEnd":751.4000000953674,"responseStart":751.4000000953674,"secureConnectionStart":365.2000002861023},{"duration":392.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":365.30000019073486,"connectEnd":365.30000019073486,"connectStart":365.30000019073486,"domainLookupEnd":365.30000019073486,"domainLookupStart":365.30000019073486,"fetchStart":365.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":365.30000019073486,"responseEnd":757.8000001907349,"responseStart":757.8000001907349,"secureConnectionStart":365.30000019073486},{"duration":393,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":365.59999990463257,"connectEnd":365.59999990463257,"connectStart":365.59999990463257,"domainLookupEnd":365.59999990463257,"domainLookupStart":365.59999990463257,"fetchStart":365.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":365.59999990463257,"responseEnd":758.5999999046326,"responseStart":758.5999999046326,"secureConnectionStart":365.59999990463257},{"duration":393.8999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":365.7000002861023,"connectEnd":365.7000002861023,"connectStart":365.7000002861023,"domainLookupEnd":365.7000002861023,"domainLookupStart":365.7000002861023,"fetchStart":365.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":365.7000002861023,"responseEnd":759.5999999046326,"responseStart":759.5999999046326,"secureConnectionStart":365.7000002861023},{"duration":470.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":365.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":365.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":836.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":394.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":366.09999990463257,"connectEnd":366.09999990463257,"connectStart":366.09999990463257,"domainLookupEnd":366.09999990463257,"domainLookupStart":366.09999990463257,"fetchStart":366.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":366.09999990463257,"responseEnd":760.9000000953674,"responseStart":760.9000000953674,"secureConnectionStart":366.09999990463257},{"duration":470.2999997138977,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":366.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":366.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":836.5,"responseStart":0,"secureConnectionStart":0},{"duration":395.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":366.40000009536743,"connectEnd":366.40000009536743,"connectStart":366.40000009536743,"domainLookupEnd":366.40000009536743,"domainLookupStart":366.40000009536743,"fetchStart":366.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":366.40000009536743,"responseEnd":761.8000001907349,"responseStart":761.8000001907349,"secureConnectionStart":366.40000009536743},{"duration":872.2000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":374,"connectEnd":374,"connectStart":374,"domainLookupEnd":374,"domainLookupStart":374,"fetchStart":374,"redirectEnd":0,"redirectStart":0,"requestStart":374,"responseEnd":1246.2000002861023,"responseStart":1246.2000002861023,"secureConnectionStart":374},{"duration":976.9000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":374.09999990463257,"connectEnd":374.09999990463257,"connectStart":374.09999990463257,"domainLookupEnd":374.09999990463257,"domainLookupStart":374.09999990463257,"fetchStart":374.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":374.09999990463257,"responseEnd":1351,"responseStart":1351,"secureConnectionStart":374.09999990463257},{"duration":380.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":866.0999999046326,"connectEnd":866.0999999046326,"connectStart":866.0999999046326,"domainLookupEnd":866.0999999046326,"domainLookupStart":866.0999999046326,"fetchStart":866.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":866.0999999046326,"responseEnd":1246.5999999046326,"responseStart":1246.5999999046326,"secureConnectionStart":866.0999999046326},{"duration":367.1000003814697,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1187.0999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1187.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1554.2000002861023,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":155,"responseStart":353,"responseEnd":359,"domLoading":361,"domInteractive":1484,"domContentLoadedEventStart":1484,"domContentLoadedEventEnd":1549,"domComplete":2671,"loadEventStart":2671,"loadEventEnd":2673,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1464.3000001907349},{"name":"bigPipe.sidebar-id.end","time":1465.2000002861023},{"name":"bigPipe.activity-panel-pipe-id.start","time":1465.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1468.5},{"name":"activityTabFullyLoaded","time":1559.4000000953674}],"measures":[],"correlationId":"75da1b8b76fdda","effectiveType":"4g","downlink":9.7,"rtt":0,"serverDuration":132,"dbReadsTimeInMs":32,"dbConnsTimeInMs":44,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}