Type:
Task
Priority:
Minor
Resolution:
Unresolved
Fix Version/s:
None
I'm used to declarative granting to users:
GRANT USAGE...
REVOKE ALL PRIVILEGES, GRANT OPTION FROM ...
GRANT <only these> ...
Roles make it difficult. There seems to be no way to revoke all roles from a user or a role, without dropping the grantee and recreating it. Dropping, AFAIK, has unwanted effects, like clearing a password (for a user) or cascade revoke from other roles and users (see below).
I tried to work around with a procedure and prepared statement (reading roles_mapping), but got ERROR 1295 (HY000): This command is not supported in the prepared statement protocol yet.
REVOKE ALL PRIVILEGES, GRANT OPTION FROM foo; seems revoke roles, but also fails on non-existing grants (Inherited from the role, I think. Might be MDEV-5228 .).
So, I'm out of options. The last straw is that REVOKE role1 FROM role2 is not idempotent
MariaDB [(none)]> CREATE ROLE foo;
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> GRANT _bob_live_sg TO foo;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> REVOKE ALL PRIVILEGES, GRANT OPTION FROM foo;
ERROR 1147 (42000): There is no such grant defined for user 'foo' on host '' on table 'catalog_attribute_option_shoes_shaft_width'
MariaDB [(none)]> REVOKE _bob_live_sg FROM foo;
ERROR 1962 (HY000): Cannot revoke role '_bob_live_sg' from: 'foo'.
MariaDB [(none)]> show grants for foo;
+-----------------------------+
| Grants for foo |
+-----------------------------+
| GRANT USAGE ON *.* TO 'foo' |
+-----------------------------+
1 row in set (0.00 sec)
MariaDB [(none)]> GRANT _bob_live_sg TO foo;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT _bob_live_sg TO foo;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> REVOKE _bob_live_sg FROM foo;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> REVOKE _bob_live_sg FROM foo;
ERROR 1962 (HY000): Cannot revoke role '_bob_live_sg' from: 'foo'.
MariaDB [(none)]> GRANT foo TO pashev@localhost;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show grants for pashev@localhost;
+------------------------------------------------------------------------------------------------------------------------+
| Grants for pashev@localhost |
+------------------------------------------------------------------------------------------------------------------------+
| GRANT ops_sg TO 'pashev'@'localhost' |
| GRANT foo TO 'pashev'@'localhost' |
| GRANT PROCESS, SHOW DATABASES, REPLICATION CLIENT, SHOW VIEW ON *.* TO 'pashev'@'localhost' IDENTIFIED VIA unix_socket |
| GRANT SELECT, EXECUTE ON `mysql`.* TO 'pashev'@'localhost' |
+------------------------------------------------------------------------------------------------------------------------+
4 rows in set (0.00 sec)
MariaDB [(none)]> drop role foo;
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> show grants for pashev@localhost;
+------------------------------------------------------------------------------------------------------------------------+
| Grants for pashev@localhost |
+------------------------------------------------------------------------------------------------------------------------+
| GRANT ops_sg TO 'pashev'@'localhost' |
| GRANT PROCESS, SHOW DATABASES, REPLICATION CLIENT, SHOW VIEW ON *.* TO 'pashev'@'localhost' IDENTIFIED VIA unix_socket |
| GRANT SELECT, EXECUTE ON `mysql`.* TO 'pashev'@'localhost' |
+------------------------------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)
MariaDB [(none)]> CREATE ROLE foo;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT _bob_live_sg TO foo;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show grants for pashev@localhost;
+------------------------------------------------------------------------------------------------------------------------+
| Grants for pashev@localhost |
+------------------------------------------------------------------------------------------------------------------------+
| GRANT ops_sg TO 'pashev'@'localhost' |
| GRANT PROCESS, SHOW DATABASES, REPLICATION CLIENT, SHOW VIEW ON *.* TO 'pashev'@'localhost' IDENTIFIED VIA unix_socket |
| GRANT SELECT, EXECUTE ON `mysql`.* TO 'pashev'@'localhost' |
+------------------------------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)
MariaDB [(none)]> PREPARE s FROM 'REVOKE _bob_live_sg FROM foo';
ERROR 1295 (HY000): This command is not supported in the prepared statement protocol yet
{"report":{"fcp":1476.3000001907349,"ttfb":298.2000002861023,"pageVisibility":"visible","entityId":56085,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"360a283a-6a39-4f54-8154-857d0ff9c2ac","navigationType":0,"readyForUser":1674.4000000953674,"redirectCount":0,"resourceLoadedEnd":1923.7000002861023,"resourceLoadedStart":304.2000002861023,"resourceTiming":[{"duration":599,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":304.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":304.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":903.2000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":598.8999996185303,"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":304.6000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":304.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":903.5,"responseStart":0,"secureConnectionStart":0},{"duration":607.9000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":304.80000019073486,"connectEnd":304.80000019073486,"connectStart":304.80000019073486,"domainLookupEnd":304.80000019073486,"domainLookupStart":304.80000019073486,"fetchStart":304.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":304.80000019073486,"responseEnd":912.7000002861023,"responseStart":912.7000002861023,"secureConnectionStart":304.80000019073486},{"duration":753.8000001907349,"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":305,"connectEnd":305,"connectStart":305,"domainLookupEnd":305,"domainLookupStart":305,"fetchStart":305,"redirectEnd":0,"redirectStart":0,"requestStart":305,"responseEnd":1058.8000001907349,"responseStart":1058.8000001907349,"secureConnectionStart":305},{"duration":801.4000000953674,"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":305.30000019073486,"connectEnd":305.30000019073486,"connectStart":305.30000019073486,"domainLookupEnd":305.30000019073486,"domainLookupStart":305.30000019073486,"fetchStart":305.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":305.30000019073486,"responseEnd":1106.7000002861023,"responseStart":1106.7000002861023,"secureConnectionStart":305.30000019073486},{"duration":807.5,"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":305.40000009536743,"connectEnd":305.40000009536743,"connectStart":305.40000009536743,"domainLookupEnd":305.40000009536743,"domainLookupStart":305.40000009536743,"fetchStart":305.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":305.40000009536743,"responseEnd":1112.9000000953674,"responseStart":1112.9000000953674,"secureConnectionStart":305.40000009536743},{"duration":808.3000001907349,"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":305.5,"connectEnd":305.5,"connectStart":305.5,"domainLookupEnd":305.5,"domainLookupStart":305.5,"fetchStart":305.5,"redirectEnd":0,"redirectStart":0,"requestStart":305.5,"responseEnd":1113.8000001907349,"responseStart":1113.8000001907349,"secureConnectionStart":305.5},{"duration":816.9000000953674,"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":305.7000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":305.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1122.6000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":810.9000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":305.80000019073486,"connectEnd":305.80000019073486,"connectStart":305.80000019073486,"domainLookupEnd":305.80000019073486,"domainLookupStart":305.80000019073486,"fetchStart":305.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":305.80000019073486,"responseEnd":1116.7000002861023,"responseStart":1116.7000002861023,"secureConnectionStart":305.80000019073486},{"duration":819,"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":306.1000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":306.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1125.1000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":816.5,"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":306.2000002861023,"connectEnd":306.2000002861023,"connectStart":306.2000002861023,"domainLookupEnd":306.2000002861023,"domainLookupStart":306.2000002861023,"fetchStart":306.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":306.2000002861023,"responseEnd":1122.7000002861023,"responseStart":1122.7000002861023,"secureConnectionStart":306.2000002861023},{"duration":920.0999999046326,"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":307.1000003814697,"connectEnd":307.1000003814697,"connectStart":307.1000003814697,"domainLookupEnd":307.1000003814697,"domainLookupStart":307.1000003814697,"fetchStart":307.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":307.1000003814697,"responseEnd":1227.2000002861023,"responseStart":1227.2000002861023,"secureConnectionStart":307.1000003814697},{"duration":1601.5,"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":318.5,"connectEnd":318.5,"connectStart":318.5,"domainLookupEnd":318.5,"domainLookupStart":318.5,"fetchStart":318.5,"redirectEnd":0,"redirectStart":0,"requestStart":318.5,"responseEnd":1920,"responseStart":1920,"secureConnectionStart":318.5},{"duration":139.2000002861023,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1085.4000000953674,"connectEnd":1085.4000000953674,"connectStart":1085.4000000953674,"domainLookupEnd":1085.4000000953674,"domainLookupStart":1085.4000000953674,"fetchStart":1085.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1085.4000000953674,"responseEnd":1224.6000003814697,"responseStart":1224.6000003814697,"secureConnectionStart":1085.4000000953674},{"duration":510,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1413.7000002861023,"connectEnd":1413.7000002861023,"connectStart":1413.7000002861023,"domainLookupEnd":1413.7000002861023,"domainLookupStart":1413.7000002861023,"fetchStart":1413.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":1413.7000002861023,"responseEnd":1923.7000002861023,"responseStart":1923.7000002861023,"secureConnectionStart":1413.7000002861023},{"duration":512.9000000953674,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1466.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1466.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1979.4000000953674,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":134,"responseStart":298,"responseEnd":305,"domLoading":302,"domInteractive":1980,"domContentLoadedEventStart":1980,"domContentLoadedEventEnd":2039,"domComplete":3416,"loadEventStart":3416,"loadEventEnd":3418,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1926.9000000953674},{"name":"bigPipe.sidebar-id.end","time":1927.8000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1928},{"name":"bigPipe.activity-panel-pipe-id.end","time":1942.1000003814697},{"name":"activityTabFullyLoaded","time":2051.6000003814697}],"measures":[],"correlationId":"3afaf47a5af0dc","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":97,"dbReadsTimeInMs":7,"dbConnsTimeInMs":15,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}