The JSMA customers provides access to the customers (JSMA customer) in the instance.
What can JSMA customers do for me?You can use the JSMA customers to access and manipulate customers in the database |
Here is an example on how to write data to a JSMA customers:
... customers.each(function(customer) { customer.setConfirmed(true); }); ... |
Here is an example on how to read data from a JSMA customers:
... customers.findByLoginName('Alice1980') // => customer ... |
The JSMA customers provides the following methods:
Returns the current logged in customer for the request as a JSMA customer if available.
... customers.current // => customer ... |
Executes the given function on every customer in the database.
... customers.each(function(customer) { customer.setConfirmed(true); }); ... |
A function to be called on each JSMA customer.
The function signature customers.find(query, [limit]) is deprecated and will produce a warning in log files. |
Searches and retrieves a list of JSMA customer from the Sphinx index.
... customers.find('alice') // => [customer0, customer1, ...] ... |
If no value for limit is provided, the default value of 10 will be used.
Retrieves a single JSMA customer from the database by id.
Avoid usage of findByIdIds change whenever a package is reimported. So please avoid using ids whenever possible. Also delivering contents to users by id might make it possible for users to flip through the files (and by that see contents of others possibly) by changing the ids in requests. |
... customers.findById(1) // => customer ... |
Retrieves a single JSMA customer from the database by loginName.
... customers.findByLoginName('Alice1980') // => customer ... |
Returns true or false whether there is a currently logged in customer in the context of execution.
... customers.loggedIn // => false ... |
Logs in a customer by name and password.
Returns the JSMA customer if successful.
... customers.login('alice', 'alices password'); // => customer ... |
Logs out the current customer.
... customers.logout() ... |
Registers a new customer and returns it as a JSMA customer.
... customers.register('login', 'password', 'display_name', portal, 'info@example.org') // => customer ... |
Either a JSMA portal or the id of a portal.
The current JSMA request.
... customers.request // => request ... |
The current JSMA session.
... customers.session // => session ... |