Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-22313

SHOW GRANTS does not prints a user's default role

    XMLWordPrintable

    Details

      Description

      Let's say that we create a role and a user account:

      MariaDB [(none)]> CREATE ROLE 'test_role';
      Query OK, 0 rows affected (0.004 sec)
       
      MariaDB [(none)]> CREATE USER 'test_user'@'%';
      Query OK, 0 rows affected (0.004 sec)
      

      And then let's say that we set this role to be the default role for the user account:

      MariaDB [(none)]> GRANT 'test_role' TO 'test_user'@'%';
      Query OK, 0 rows affected (0.004 sec)
       
      MariaDB [(none)]> SET DEFAULT ROLE 'test_role' FOR 'test_user'@'%';
      Query OK, 0 rows affected (0.004 sec)
      

      Neither SHOW CREATE USER now SHOW GRANTS prints this default role for the user account:

      MariaDB [(none)]> SHOW CREATE USER 'test_user'@'%';
      +-----------------------------+
      | CREATE USER for test_user@% |
      +-----------------------------+
      | CREATE USER 'test_user'@'%' |
      +-----------------------------+
      1 row in set (0.000 sec)
       
      MariaDB [(none)]> SHOW GRANTS FOR 'test_user'@'%';
      +---------------------------------------+
      | Grants for test_user@%                |
      +---------------------------------------+
      | GRANT test_role TO 'test_user'@'%'    |
      | GRANT USAGE ON *.* TO 'test_user'@'%' |
      +---------------------------------------+
      2 rows in set (0.000 sec)
      

      In my opinion, it should at least be printed by SHOW GRANTS, since it is somewhat related to one of the grants that is printed.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              serg Sergei Golubchik
              Reporter:
              GeoffMontee Geoff Montee
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: