In SpinalCoreJs, the management of users is done with a set of function of the SpinalUserManager object: - get_user_id
- new_account
- change_password
- delete_account
- get_admin_id
- change_password_by_admin
- delete_account_by_admin
- change_account_rights_by_admin
get_user_id(options, user_name, password, success_callback, error_callback = null)- options: String the parameter to connect to the SpinalHub, example "http://127.0.0.1:8888"
- user_name: String containing the username.
- password: String containing the password of the user.
- success_callback: function callback with the response when the function succeed.
- error_callback (optionnal): function callback with the response or status error when the function fail.
Code Block |
---|
| SpinalUserManager.get_user_id('http://127.0.0.1:8888', 'test@spinalhub', 'password',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } ); |
new_account(options, user_name, password, success_callback, error_callback = null)- options: String the parameter to connect to the SpinalHub, example "http://127.0.0.1:8888"
- user_name: String containing the username.
- password: String containing the password of the user.
- success_callback: function callback with the response when the function succeed.
- error_callback (optionnal): function callback with the response or status error when the function fail.
Code Block |
---|
| SpinalUserManager.new_account('http://127.0.0.1:8888', 'test@spinalhub', 'password',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } );
|
Anchor |
---|
| change_password |
---|
| change_password |
---|
| change_password(options, user_id, password, new_password, success_callback, error_callback = null)
- options: String the parameter to connect to the SpinalHub, example "http://127.0.0.1:8888"
- user_id: Contain the user id.
- password: String containing the password of the user.
- new_password: String containing the new_password of the user.
- success_callback: function callback with the response when the function succeed.
- error_callback (optionnal): function callback with the response or status error when the function fail.
Code Block |
---|
| SpinalUserManager.change_password('http://127.0.0.1:8888', 777777, 'password', 'new_password',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } ); |
Anchor |
---|
| delete_account |
---|
| delete_account |
---|
| delete_account(options, user_id, password, success_callback, error_callback = null)
- options: String the parameter to connect to the SpinalHub, example "http://127.0.0.1:8888"
- user_id: Contain the user id.
- password: String containing the password of the user.
- success_callback: function callback with the response when the function succeed.
- error_callback (optionnal): function callback with the response or status error when the function fail.
Code Block |
---|
| SpinalUserManager.delete_account('http://127.0.0.1:8888', 777777, 'password',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } ); |
get_admin_id(options, admin_name, password, success_callback, error_callback = null)- options: String the parameter to connect to the SpinalHub, example "http://127.0.0.1:8888"
- admin_name: String containing the admin username.
- password: String containing the password of the admin user.
- success_callback: function callback with the response when the function succeed.
- error_callback (optionnal): function callback with the response or status error when the function fail.
Code Block |
---|
| SpinalUserManager.get_admin_id('http://127.0.0.1:8888', 'admin name', 'password',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } ); |
Anchor |
---|
| change_password_by_admin |
---|
| change_password_by_admin |
---|
| change_password_by_admin(options, user_name, new_password, admin_id, admin_password, success_callback, error_callback = null)
- options: String the parameter to connect to the SpinalHub, example "http://127.0.0.1:8888"
- user_name: String containing the username.
- new_password: String containing the new password of the user.
- admin_id: Contain the id of a admin (default: 644 or 168)
- admin_password: String containing the password of the admin.
- success_callback: function callback with the response when the function succeed.
- error_callback (optionnal): function callback with the response or status error when the function fail.
Code Block |
---|
| SpinalUserManager.change_password_by_admin('http://127.0.0.1:8888', 777777, 'new_password', 644,'4YCSeYUzsDG8XSrjqXgkDPrdmJ3fQqHs',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } ); |
Anchor |
---|
| delete_account_by_admin |
---|
| delete_account_by_admin |
---|
| delete_account_by_admin(options, user_name, admin_id, admin_password, success_callback, error_callback = null)
- options: String the parameter to connect to the SpinalHub, example "http://127.0.0.1:8888"
- user_name: String containing the username.
- admin_id: Contain the id of a admin (default: 644 or 168)
- admin_password: String containing the password of the admin.
- success_callback: function callback with the response when the function succeed.
- error_callback (optionnal): function callback with the response or status error when the function fail.
Code Block |
---|
| SpinalUserManager.delete_account_by_admin('http://127.0.0.1:8888', 777777, 644,'4YCSeYUzsDG8XSrjqXgkDPrdmJ3fQqHs',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } ); |
Anchor |
---|
| change_account_rights_by_admin |
---|
| change_account_rights_by_admin |
---|
| change_account_rights_by_admin(options, user_name, right, admin_id, admin_password, success_callback, error_callback = null)
- options: String the parameter to connect to the SpinalHub, example "http://127.0.0.1:8888"
- user_name: String containing the username.
- right: Contain the right (0 = Read/Write // 1 = Read).
- admin_id: Contain the id of a admin (default: 644 or 168)
- admin_password: String containing the password of the admin.
- success_callback: function callback with the response when the function succeed.
- error_callback (optionnal): function callback with the response or status error when the function fail.
Code Block |
---|
| SpinalUserManager.change_account_rights_by_admin('http://127.0.0.1:8888', 'test@spinalhub', 0, '644','4YCSeYUzsDG8XSrjqXgkDPrdmJ3fQqHs',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } ); |
|