Mendix Client 5 API Documentation


mx.session

Access to the user’s session.

Methods

isGuest()

This method is called to determine if this is an anonymous session.

Returns

Type Description
Boolean true if the current user is Anonymous.

Example

mx.session.isGuest();   // Returns true if logged in, false otherwise.

getUserId()

This method returns the current user’s GUID.

Returns

Type Description
Number The GUID of the current user.

Example

mx.session.getUserId(); // "2533274790395905"

getUserClass()

This method returns the Entity of the current user (System.User or a subclass).

Returns

Type Description
String The entity of the current user.

Example

mx.session.getUserClass(); // "System.User"

getUserName()

This method returns the Name attribute of the current user.

Returns

Type Description
String The Name attribute of the current user.

Example

mx.session.getUserName(); // "MxAdmin"

getUserAttribute()

This method returns the value of the passed attribute of the current user.

Parameters

Name Type Description
attr String The attribute to retrieve.

Returns

Type Description
Any The value of the passed attribute (if any).

Example

mx.session.getUserAttribute("Blocked");    // false