Get Current Admin User Role id programmatically in Magento 2.

Magento 2 Contains Multiple Users for admin panel to access different section of the functionality based on their User Roles.

You can see User Roles in the admin panel by click on the left navigation System -> Permissions -> User Roles.

You can get current logged user id in Magento 2 by calling

Class.

You need to call getUserRoleId() function from the above class to get Current User role id.

The return value will be User Id of current User.