Creates and returns a Hublify App-User-Object.

This is always initialized as the authenticated current Hublify App-User, calling the app_render-Function via Hublify API.

This is object is only available, when Template-Rendering is called via the Hublify API and not in the scope of H-CMS's website/shop-frontends.


Functions

Following functions are available for this object:


hasPermission(...)

Checks if the Hublify-User has the single or permission-expression.

Syntax

hasPermission(?string $permission): bool

  • $permission
    A single Application-Right or boolean Expression of those.

Return

Returns TRUE if the permission is granted to that right or the expression evaluates to TRUE, else FALSE. If no right or unknown right is queried FALSE is returned.

Example - single right

Most commonly to check only one right for permission:

{% if (hublify.hfyUser().hasPermission( 'PERSON_CREATE' )) %}
   ...
{% endif %}


Example - permission boolean expression

You can use complex boolean expressions, by using operators, such as:   "&&" (AND), "||" (OR) and "!" (NOT).

{% if (hublify.hfyUser().hasPermission( '(PERSON_UPDATE || PERSON_DELETE) && !OTHER_PREVENT' ) ) %}
   ...
{% endif %}



username( )

Simply returns the username of the current user.

Syntax

username(): string


Return

Returns the Hublify App User's username, as authenticated via the API.

Example - single right

Most commonly to check only one right for permission:

Your username: "{{ hublify.hfyUser().username() }}"