-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SHOW PRINCIPALS for admin to see what roles were granted to users. #3167
Comments
Hive has: |
I think it is missing. What ANSI SQL says about this? I guess there is some table defined in information_schema. |
The SQL standard does not have anything for SHOW, and each database does it differently. :( In Postgres you issue \dg or \du in the shell. MySQL has SHOW GRANTS [FOR user [USING role]] and MySQL also lists which roles have been granted to a user, like this:
And even:
So we could "just" add the "FOR" syntax and have SHOW GRANTS also show role assignments. |
Snowflake has Presto currently has: Perhaps the simplest (from the viewpoint of syntax at least) is to simply extend this to: That would align well with the CATALOG argument: If not specified the current catalog is used, otherwise the specified CATALOG. The TO argument would be same: Current user by default, otherwise the specified user or role. Only an admin would be allowed to run this with What do you folks think? Happy to do a PR if we agree. Of course I'd have to check the metastore has an API for that. Since Hive has So the options are:
I'd vote for (4) followed by (1). Edit: I take this back. Since only roles are actually stored in the Hive Metastore, the only real option is to discover it that way: List all roles, then list user/roles that has this role granted. Only option the Hive option (1) allows for that. It seems that's we should do. And in order to find roles for users, we should do (4) as well. So best (1) and (4). |
I verified that the Hive Metastore API has everything needed. |
Opinions? This seems to be an important gap. What I'm looking is two abilities for an admin:
(1) Could be The meta point is: Most people defer these things to Hive still, I'd like to be able to do them straight through Presto. I'm happy to start a PR. Maybe I'll start on with the proposed syntax changes so that we can have a look and try, and when that's OK fill is the access parts, tests, etc. |
Closing this. This is now implemented via a new table |
Apologies if I missed something.
A user can see all roles (s)he was granted, but there's no way I could find where an admin can see the membership of all roles or role assignments for all users. Neither through a SHOW command, nor via the information_schema.
An admin can create roles, assign roles to users, but has no way to see which roles were assigned to what user.
Is that intentional or simply missing?
The text was updated successfully, but these errors were encountered: