JSMA user

Overview

The JSMA user provides functionality for handling users

What can JSMA user do for me?

You could use the JSMA user to edit a user

Index

Usage

writing data

Here is an example on how to write data to a JSMA user:

...
var text = request.parameter("text");
user.set("smp.util.notes.text", text);
...

reading data

Here is an example on how to read data from a JSMA user:

... 
user.name
...

Methods

The JSMA user provides the following methods:

user.flexAttributes

Returns an array of the flex attributes of a user

Example

... 
user.flexAttributes
...

string user.get(key)

Returns the value of key as string or null if no value is set under the key.

Example

... 
user.get(key)
...

Parameter key:string (required)

The key to be looked up in the flexAttributes of the user.

boolean user.has(key)

Returns a boolean value depending on whether key is present for a given user.

Example

... 
user.has(key)
...

Parameter key:string (required)

The key to be checked in the flexAttributes of the user.

int user.id

Returns the id of the user

Example

... 
user.id
...

user.increment(key)

Increments the vale of a given key by one.

Example

... 
user.increment(key)
...

Parameter key:string (required)

The key to be incremented in the flexAttributes of the user.

string user.name

Returns the name of the user

Example

... 
user.name
...

user.remove(key)

Removes the key from the flexAttributes of the user

Example

... 
user.remove(key)
...

Parameter key:string (required)

The key to be removed from the flexAttributes of the user.

user.set(key, value)

Sets the value of a specified key for a given user.

Example

... 
var text = request.parameter("text");
  
user.set("smp.util.notes.text", text);
...

Parameter key:string (required)

The key to be set in the flexAttributes of the user.

Parameter value:string (required)

The value to be set for the key

user.setPassword(password)

Sets the password for a user

Example

... 
user.setPassword(password)
...

Parameter password (required)