Attempting to access user object in portal customization

Hello all,

I have a request from a client to hide and show the cards in the first screenshot below depending on the user being part of their HR department. I have found how to hide the card, but I am not sure how to go about finding if the user is part of HR.

I looked through the code and found that there is a reference to a user object (second screenshot below), but when I try to reference that user in my script it gives me an error. I tried referencing the portal object in the second screenshot below and I was able to do so successfully.

Is there a way to get user information within a script? Or is there a better way to hide these cards based on if a user is part of HR or not?

I wrote this code to see what objects I can access:

<script>
console.log("client:");
console.log(portal);
console.log(user);
</script>

the portal successfully printed out the portal object, while the user gave me the following error:

Please let me know if there is any additional information I can provide and thank you for taking the time to look through my post.

Hi @Jose_Escobar,

I guess we do not have user portal experts in our community.

We couldn’t find any documentation for it. I have created a support ticket for the Freshservice support team on your behalf. Please follow up on this ticket thread (#15860849).
Let me know in this thread if any help is required regarding this ticket.