[
https://issues.apache.org/jira/browse/HIVE-13085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15152103#comment-15152103
]
Oleksiy Sayankin commented on HIVE-13085:
-----------------------------------------
*Added {{!username}} command to beeline CLI.*
1. If there is no connection to database
{noformat}
beeline> !username
{noformat}
returns nothing.
2 If user successfully connected to HiveServer2 {{!username}} returns logged in
user:
{noformat}
beeline> !connect jdbc:hive2://localhost:10000
Connecting to jdbc:hive2://localhost:10000
Enter username for jdbc:hive2://localhost:10000: testuser2
Enter password for jdbc:hive2://localhost:10000: *********
Connected to: Apache Hive
Driver: Hive JDBC
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://localhost:10000> !username
testuser2
{noformat}
3. If there is two connections, {{!username}} returns logged in user for
current connection (#0 in our case):
{noformat}
0: jdbc:hive2://localhost:10000> !list
2 active connections:
#0 open jdbc:hive2://localhost:10000
#1 open jdbc:hive2://localhost:10000
0: jdbc:hive2://localhost:10000> !username
test
{noformat}
4. If we change current connection, {{!username}} returns new value:
{noformat}
0: jdbc:hive2://localhost:10000> !go 1
1: jdbc:hive2://localhost:10000> !username
testuser1
{noformat}
5. If there are two consoles at the same cluster node with different sets of
connections, then the results of {{!username}} is independent each other
console, that is we have two {{Beeline.class}} instances and each one has its
own current connection.
> Need an API / configuration parameter to find out the authenticated user
> from beeline
> --------------------------------------------------------------------------------------
>
> Key: HIVE-13085
> URL: https://issues.apache.org/jira/browse/HIVE-13085
> Project: Hive
> Issue Type: Improvement
> Reporter: Oleksiy Sayankin
> Assignee: Oleksiy Sayankin
> Attachments: HIVE-13085.1.patch
>
>
> This request has come from the customer who wanted an API / configuration
> parameter to identify the authenticated user from the beeline. This is
> similar to the request done in the thread below:
> https://community.hortonworks.com/questions/2620/hadoop-environment-variable-or-configuration-varia.html
> But this would not be a feasible option for the requestor. So here the
> general ask is once the user is logged in to the beeline, they wanted to
> identify who this user is and then use this information to enforce the ACLs
> on the tables through the customer's custom code.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)