Logotype Sitevision Developer
Log in

Log in

How do I find the current user and its properties?

Use a combination of PortletContextUtil and Properties to extract the current user and its properties.

Published: 2022-07-22  |  Updated: 2024-09-26

In order to get the current user (as a JCR Node) the method getCurrentUser of PortletContextUtil is used.

To extract properties from a node in Sitevision either Properties or PropertyUtil can be used. This example will use Properties.

Step 1 - Get instances of utilities

For WebApp/RESTApp - use import:

For Script module - use require:

Step 2 - Make use of the utilities

Regarding properties

What properties there is to extract from each node type is documented on the node types page.

Note regarding user types

In Sitevision there are 3 types of users:

Note that available properties vary between the user types. If a property which is not available for the user type is being requested, null will be returned.