Current user reference in template for visibility script

Hello Experts, 

Can anyone tell me if there is a way to reference the current user in a template? I need to add something in the visibility script to be true based on role.

Any help is appreciated. 

Thank you,

Lu 

  • Hi,

    Instead of the template, why not checking "View" permissions for that role on the column ?

  • I would go for the OnLoading-Script of the table where you want to alter the CanSee property for the column.

    In addition, I would check for the existence of a program function (QBMFeature) for the current user. This is way faster than checking a role membership.

    A sample code would look like this

    If Not Session.Principal.Features.IsAllowed("<QBMFeature>") Then
        Entity.Columns("<ColumnName>").CanSee = False
    End If
     

  • Hi JuanCarlos,,
    Yes that is an option. Although when originally setup years ago the PSO team used the out of box Role based groups which is VI_4_ALLUSERS and VI_4_ALLUSERS_LOOKUP to assign view. The columns i need to hide cannot be changed in these OOB rules. I would have to create replacement role based groups and use that on the applications roles. It seems the OOB roles have too many permissions that i don't want to disrupt the end users if i don't get the replacement rules right. Unless you can suggest a way to copy role based permissions groups and create replacements. Thank you, Lu

  • Thank you Markus i will give this a try. It would only be for users coming in from the Web portal. Do you have a suggestion on which program function to use for this? In the Web portal people are creating Reports and need to hide some columns for selection.

  • An easy way to copy role based permissions groups and create replacements

    In Designer: Permissions > Permissions groups > Role based permissions groups
    Ex. select: VI_4_ALLUSER_LOOKUP
    On the right in the Tasks dialog select: "Edit permissions group: VI_4_ALLUSER_LOOKUP"
    In the menu bar: Permissions group > Copy permissions group

    Now you will see the Permissions Group Copy Wizard

  • Niels, This is great. Thank you for the instruction. I found that this will do what i need, However it comes with another issue. I'm not sure how to handle. Once I remove the permission the column can still be  selected in a report. Although the value shows hidden. One of the other columns is showing some values in the column but some show hidden. I'm not sure how to untangle that all as to why some show and some do not. I think if i could just get the values hidden from being selected in the reports I should be good.

    Anyone know how to just limit some columns from being selected in reporter?

    Thank you, Lu