hiding tab component based on custom role

Vedavalli
Mega Sage

Hi

 

How to hide tab component based on custom role?

 

Thanks in advance

2 ACCEPTED SOLUTIONS

Dr Atul - LNG
Tera Patron

Please share the screenshot where you want to do this.

View solution in original post

HI @Vedavalli 

 

 

  • Select the component or container that needs to have a dynamic visibility

  • In the config panel, click the visibility icon
    dgarad_0-1716546151883.png

     



  • Click on the script icon
    dgarad_1-1716546152117.png

     



  • Set the visibility condition

    /**
      * @param {params} params
      * @param {api} params.api
      * @param {TransformApiHelpers} params.helpers
      */
    function evaluateProperty({api, helpers}) {
      let user_roles = api.context.session.user.roles;
      let visibility_condition 
          = user_roles.includes("THE USER'S ROLE THAT SHOULD NOT SEE THE ELEMENT");
    	return visibility_condition;
    }​


     dgarad_2-1716546152056.png

View solution in original post

5 REPLIES 5

Hi @Vedavalli 

 can you share the script screenshot .