Skip to main content
Version: Next

Users

Overview

The Users class provides streamlined access to user information within a Qodly application, including the currently authenticated user and all users added to the Qodly app.

tip

The Users class is a shared singleton, meaning a single instance is globally available without needing manual creation. You can access it directly via the .me property without instantiating a new instance.

Functions and properties

.allUsers() : Collection    returns a collection of all users (objects) within the Qodly application.
.currentUser() : Object    returns an object containing all information on the current Qodly user.
.me : cs.Qodly.Users    returns the current instance of the Users singleton.

.allUsers()

.allUsers() : Collection

ParameterTypeDescription
ResultcollectionCollection of Qodly user objects

Description

The .allUsers() function returns a collection of all users (objects) within the Qodly application..

Returned value

The function returns a collection of User objects.

Example

To implement a allUsers() function in a custom class:

var users : collection
users = cs.Qodly.Users.me.allUsers()

.currentUser()

.currentUser() : Object

ParameterTypeDescription
ResultObjectCurrent Qodly user information.

Description

The .currentUser() function returns an object containing all information on the current Qodly user.

If a user is authenticated, it returns a User object containing detailed user information. If no user is authenticated, it returns null.

User object

The User object returned by the function above contains the following properties:

PropertyTypeDescription
emailStringThe user's email used for account creation.The user's email used for account creation.
roleStringThe user's role within the application Roles & Privileges.
firstnameStringThe user's first name.
lastnameStringThe user's last name.

Example

To implement a currentUser() function in a custom class:

var currentUser : object
currentUser = cs.Qodly.Users.me.currentUser()

.me

.me : cs.Qodly.Users

ParameterTypeDescription
Resultcs.Qodly.UsersThe Users Singleton Object containing system properties and the current user details.

Description

The .me property returns the current instance of the Users singleton. It provides direct access to the currently authenticated user and the available system properties.

It must be used when calling functions like currentUser() or allUsers().

Why .me is Required:

If you attempt to call:

var user : object
user = cs.Qodly.Users.currentUser()

You will encounter an error: function call error (is not a function).

The correct way to access the current user is:

var user : object
user = cs.Qodly.Users.me.currentUser()

The .me ensures the function is being called from the current active instance of the Users singleton.