Adding a role through Hive

How to add a role in Hive.

You can create a role either through Ranger, or through Hive.
To add a role through Hive, the user must have Admin_Role privilege in Ranger.
To grant the Admin_Role privilege, in Ranger:
  1. Select Settings > Users/Groups/Roles, then click the Users tab.
  2. Click the user name to which you want the Admin_Role privilege granted.
    The User Edit page appears.
    Adding Admin privilege to a user
  3. From the Select Role list, select Admin, then click Save.
In Hive:
  1. Log in as a user with Admin_Role privilege.
  2. Type the following command:
    CREATE ROLE external_hr_role_01;

    Any user with Is_Role_Admin privilege has the ability to assign the role to other users in Hive.

    For example, to grant this new role to the user hr_user01, type:
    GRANT ROLE external_hr_role_01 TO USER hr_user01;

    hr_user01 appears in Ranger having the external_hr_role_01 role.

    You can also grant Is_Role_Admin privilege to a specific user by typing:
    GRANT ROLE external_hr_role_01 TO USER hr_user02 WITH ADMIN OPTION;
    The role you create appears in Ranger and is recognized by Hive. The user that creates the role adds automatically to the list of users having that role. The added user has the Is_Role_Admin privilege, as shown in Ranger: