CA Service Management

  • 1.  How to get the role of the logged user?

    Posted Mar 12, 2018 10:38 AM

    Hi everyone,

     

    I need to create a PDM_LIST in HTMPL in which the "where" clause is based on the current role of the logged user. I know I can get the ID of the user by using the tag "$cst.id", so I wonder if there's a similar way to get the current role. If there's not, maybe some alternative method exists. Does anyone knows something regarding this?

     

    Thanks in advance,

     

    Diogo



  • 2.  Re: How to get the role of the logged user?

    Broadcom Employee
    Posted Mar 12, 2018 10:44 AM

    Diogo, can you describe what it is you are trying to do?  Beyond trying to discern the role of the given user.  What content is to be displayed and what should be shown per role?

     

    I ask since it may be easier to take the given content you want to change based on role and apply a dropdown or text field containing that information on each of the roles' form groups, and have the content controlled locally on the text field per form group.



  • 3.  Re: How to get the role of the logged user?

    Posted Mar 12, 2018 11:09 AM

    Hi David-Ng,

     

    What I wanted is to restrict Personalized Responses based on the role of the user... so, I've created a field for 'role' in the 'response' table, because I could restrict in the PDM_LIST that already exists in request_status_change.htmpl form (and in related forms too). This is the current code:

     

    <PDM_LIST ESC_STYLE=JS2 prefix=list factory=response where="delete_flag=0 AND (response_owner IS NULL or response_owner = U'$cst.id') AND cr_flag=1">

     

    Surely, one way to do this is creating a data partition restriction, since I could use "@root.role" structure. However, this would mean I should create this restriction for every partition in every role (current and future ones). And I think, if doing this in HTMPL forms was possible, that would be a more 'elegant' way.

     

    Thanks,

     

    Diogo



  • 4.  Re: How to get the role of the logged user?

    Broadcom Employee
    Posted Mar 12, 2018 11:26 AM

    Diogo, $args.QBE.EQ.roleID just come to my mind...maybe you can give this a try(not tested here yet). Thanks _Chi



  • 5.  Re: How to get the role of the logged user?
    Best Answer

    Posted Mar 12, 2018 01:58 PM

    Hi Chi_Chen, unfortunaltely that didn't work, I believe this was used in some forms of detail_role (or related). But you gave me an idea for searching the string "roleID". And I've found this variable: ahtop.cfgCurrentRoleID. I did some tests and it looks like this is exactly what I was looking for, it brings the ID of the current role.

     

    Thanks!

     

    Diogo



  • 6.  Re: How to get the role of the logged user?

    Broadcom Employee
    Posted Mar 12, 2018 02:04 PM

    Diogo, that is cool. Somehow I remember something like that and it seems my memory partially works(lol). Thanks _Chi



  • 7.  Re: How to get the role of the logged user?

    Posted Nov 14, 2018 04:10 PM

    Try $SESSION.ROLE_ID



  • 8.  Re: How to get the role of the logged user?

    Posted Nov 15, 2018 11:38 AM

    You beat me to it.  I use this all the time for HTMPL side conditionals.

     

    J.W.