Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

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
...

user.get(key)

Returns the value of key as string.

Example

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

Parameter key (required)

user.has(key)

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

Example

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

Parameter key (required)

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 (required)

string user.name

Returns the name of the user

Example

... 
user.name
...

user.remove(key)

Removes the given key from a user

Example

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

Parameter key (required)

user.set(key, value, [options])

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 (required)

Parameter value (required)

Parameter options (optional)

user.setPassword(password)

Sets the password for a user

Example

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

Parameter password (required)


  • No labels