Bug #82955 | Difficult to check if a role is active | ||
---|---|---|---|
Submitted: | 12 Sep 2016 19:07 | Modified: | 14 Sep 2016 13:24 |
Reporter: | Daniël van Eeden (OCA) | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Security: Roles | Severity: | S4 (Feature request) |
Version: | 8.0.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | current_role, roles |
[12 Sep 2016 19:07]
Daniël van Eeden
[13 Sep 2016 13:38]
MySQL Verification Team
Hello Daniël, Thank you for the report. Thanks, Umesh
[13 Sep 2016 13:41]
MySQL Verification Team
-- mysql> SET ROLE ALL; Query OK, 0 rows affected (0.00 sec) mysql> select current_role(); +-------------------------+ | current_role() | +-------------------------+ | `role1`@`%`,`role2`@`%` | +-------------------------+ 1 row in set (0.00 sec) mysql> select current_role() = '`role1`@`%`'; -- doesn't match +--------------------------------+ | current_role() = '`role1`@`%`' | +--------------------------------+ | 0 | +--------------------------------+ 1 row in set (0.00 sec)
[14 Sep 2016 10:13]
Georgi Kodinov
Thank you for the good observation. This is very reasonable feature request. IMHO a P_S table would be the preferred way.
[14 Sep 2016 13:24]
Daniël van Eeden
PostgreSQL uses an information schema table for this. https://www.postgresql.org/docs/current/static/infoschema-enabled-roles.html
[3 Apr 2017 7:55]
Kristofer Pettersson
You probably know about FIND_IN_SET(). SELECT FIND_IN_SET('`role`@`%`', current_role()); It would be nice to have a function which checked if a role was active or at least fixed quoting for the authorization identifier. Maybe something like this: SELECT FIND_IN_SET(quote_authorization_id('role'),current_role());