This how-to article describes how you can manage your own sub-users on our platform. This allows you to have one main-user which can create new users and assign / un-assign specific BikeTrax’s to them.
Info |
---|
|
Manual Instructions
The following steps describe how to create a new user (steps 1-3) and assign / un-assign devices to a user (step 4)
| 2. Open user creation dialog | 3. Set name, email and password and confirm with checkmark If you want to limit the permissions for this user, open the “Permissions” field and:
| 4. To assign / un-assign devices to users, select the user, open device dialog, check / uncheck desired devices
| ||
Implementation Instructions
...
Code Block | ||
---|---|---|
| ||
const TRACCAR_AUTH_TOKEN = 'AUTH_TOKEN_GIVEN_FROM_POWUNITY'; const TRACCAR_API_URL = 'https://traccariot.powunity-staging.com/api'; var name = 'Max Mustermann'; var email = 'max@mustermann.at'; var password = require('crypto').randomBytes(16).toString('hex'); // Authorization token for your management Traccar user var headers = { 'Content-Type': 'application/json', 'authorization': 'Basic ' + TRACCAR_AUTH_TOKEN }; var json = { name, email, password, deviceLimit: -1 }; console.log('Calling traccar API at', TRACCAR_API_URL); request.post({ url: TRACCAR_API_URL + '/users', headers: headers, json: json }, function (err, response, body) { if (err) { console.log('Traccar create user API call returned an error,', err); throw new Error("Error provisioning server resource, please contact support"); } // user created, add sessionToken to user profile if (response.statusCode === 200) { console.log('New traccar password has been set'); return; } console.log('Traccar returned an unknown error. Body: ' + body); throw new Error("Internal error provisioning your account, please contact support"); }); |
...