MrDraw/docs/jsclientlib/users.rst

107 lines
3.6 KiB
ReStructuredText
Raw Normal View History

2016-08-26 15:47:38 +00:00
.. sec-jsclientlib-users:
:mod:`OctoPrint.users`
----------------------
2016-09-28 10:53:43 +00:00
.. note::
2016-08-26 15:47:38 +00:00
2016-09-28 10:53:43 +00:00
Most methods here require that the used API token or a the existing browser session
has admin rights *or* corresponds to the user to be modified. Some methods
definitely require admin rights.
2016-08-26 15:47:38 +00:00
.. js:function:: OctoPrint.users.list(opts)
2016-09-28 10:53:43 +00:00
Get a list of all registered users.
Requires admin rights.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
2016-08-26 15:47:38 +00:00
.. js:function:: OctoPrint.users.get(name, opts)
2016-09-28 10:53:43 +00:00
Get information about a specific user.
:param string name: The user's name
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
2016-08-26 15:47:38 +00:00
.. js:function:: OctoPrint.users.add(user, opts)
2016-09-28 10:53:43 +00:00
Add a new user.
Requires admin rights.
:param object user: The new user
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
2016-08-26 15:47:38 +00:00
.. js:function:: OctoPrint.users.update(name, active, admin, opts)
2016-09-28 10:53:43 +00:00
Update an existing user.
Requires admin rights.
:param string name: The user's name
:param bool active: The new ``active`` state of the user
:param bool admin: The new ``admin`` state of the user
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
2016-08-26 15:47:38 +00:00
.. js:function:: OctoPrint.users.delete(name, opts)
2016-09-28 10:53:43 +00:00
Delete an existing user.
Requires admin rights.
:param string name: The user's name
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
2016-08-26 15:47:38 +00:00
.. js:function:: OctoPrint.users.changePassword(name, password, opts)
2016-09-28 10:53:43 +00:00
Change the password for a user.
:param string name: The user's name
:param string password: The new password
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
2016-08-26 15:47:38 +00:00
.. js:function:: OctoPrint.users.generateApiKey(name, opts)
2016-09-28 10:53:43 +00:00
Generate a new API key for a user.
:param string name: The user's name
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
2016-08-26 15:47:38 +00:00
.. js:function:: OctoPrint.users.resetApiKey(name, opts)
2016-09-28 10:53:43 +00:00
Reset the API key for a user to being unset.
:param string name: The user's name
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
2016-08-26 15:47:38 +00:00
.. js:function:: OctoPrint.users.getSettings(name, opts)
2016-09-28 10:53:43 +00:00
Get the settings for a user.
:param string name: The user's name
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
2016-08-26 15:47:38 +00:00
.. js:function:: OctoPrint.users.saveSettings(name, settings, opts)
2016-09-22 20:21:52 +00:00
2016-09-28 10:53:43 +00:00
Save the settings for a user.
:param string name: The user's name
:param object settings: The new settings, may be a partial set of settings which will be merged unto the current ones
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
2016-09-22 20:21:52 +00:00
.. seealso::
2016-09-28 10:53:43 +00:00
:ref:`User API <sec-api-user>`
2016-09-22 20:21:52 +00:00
The documentation of the underlying user API.