Get role of user

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BigBoss
    Member
    • Nov 2023
    • 94

    Get role of user

    Hello,
    How can I get if the authenticated user in the JS files and also the role?​​
  • abhilash.kumar.niit
    Member
    • Sep 2024
    • 59

    #2
    hi, can any one help in this ?? i also have same requirement.

    Comment

    • yuri
      Member
      • Mar 2014
      • 8747

      #3
      Within a view:

      Code:
      const hasRole = (this.getUser().attributes.rolesIds || []).includes(targetRoleId);
      Within any other class, need to inject the user: https://docs.espocrm.com/development...ncy-injection/
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      Working...