I would like to get the Role of the user logged in.
I'm trying to use the
\vendor\magento\module-user\Model\User.php class, but all results give me null or empty.
I'm trying to use
\vendor\magento\module-authorization\Model\Role.php, but the same happens, all empty.
I have achieved getting the userName of the user logged in, which might help, with this class:
I have checked the database, and in the
authoritzation_role I have:
parent_id refers to the 3 roles I have created:
What am I doing wrong here? Am I calling the right classes? Is there a better way to do it?