Skip to main content

Users

The Users class allows you to get information about users of your Qodly application. It can be used, for example, to display the name of the currently connected user.

Instantiation

To use the Users class functions, you must instantiate a Qodly users interface object using the cs.Qodly.Users.new() constructor. For example:

    //instantiate the Users interface
var usersInterface : cs.Qodly.Users
usersInterface = cs.Qodly.Users.new()

Functions and properties

cs.Qodly.Users.new() : cs.Qodly.Users    creates and returns a new object of the cs.Qodly.Users type
.getCurrentUser() : Object    returns an object containing all information on the current Qodly user
.getAllUsers() : Collection    returns a collection of all Qodly users (objects) currently connected to the application

cs.Qodly.Users.new()

cs.Qodly.Users.new() : cs.Qodly.Users

ParameterTypeDescription
Resultcs.Qodly.Users<-Users component object

Description

The cs.Qodly.Users.new() function creates and returns a new object of the cs.Qodly.Users type. The returned object will then be used to call user information functions.

.getCurrentUser()

.getCurrentUser() : Object

ParameterTypeDescription
ResultObject<-Current Qodly user information

Description

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

Qodly user object

The function returns a Qodly user object that contains the following properties:

PropertyTypeDescription
emailStringEmail of the user used to create their account
roleStringRole defined in the roles and privileges of the application
firstnameStringFirst name of the user
lastnameStringLast name of the user

Example

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

exposed function getCurrentUser() : object

var user : object
var usersInterface : cs.Qodly.Users

usersInterface = cs.Qodly.Users.new()
user = usersInterface.getCurrentUser()
return user

.getAllUsers()

.getAllUsers() : Collection

ParameterTypeDescription
Resultcollection<-Collection of Qodly user objects

Description

The .getAllUsers() function returns a collection of all Qodly users (objects) currently connected to the application.

Returned value

The function returns a collection of Qodly user objects.

Example

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

exposed function getAllUsers() : collection

var users : collection
var usersInterface : cs.Qodly.Users

usersInterface = cs.Qodly.Users.new()
users = usersInterface.getAllUsers()

return users