The tutorials in this section allow you to grant an account rights to an integration table.
Create a user account
- Open a command prompt in the tools subfolder of the <faircom> installation folder.
- Paste the following command into the command line, replacing user1 with your desired username and password1234567890 with your desired password. See the sa_admin utility for more options.
sa_admin -aADMIN -pADMIN -sFAIRCOMS -oua user1 -w password1234567890
- Run the command.
New user from ADMIN group
- Run the following to create a new account.
{ "api": "admin", "action": "createAccount", "params": { "username": "ADMIN2", "password": "ADMINADMINADMINADMIN" }, "authToken": "replaceWithAuthTokenFromCreateSession" }
- Run the following to assign the ADMIN role to the newly created account.
{ "api": "admin", "action": "assignRolesToAccounts", "params": { "add": [ { "roleNames": [ "ADMIN" ], "usernames": [ "ADMIN2" ] } ] }, "authToken": "replaceWithAuthTokenFromCreateSession" }
- Run the following in command prompt to grant permissions in SQL.
GRANT ALL PRIVILEGES ON mqtt_client TO ADMIN2; GRANT ALL PRIVILEGES ON mqtt_client_history TO ADMIN2; GRANT ALL PRIVILEGES ON mqtt_topic TO ADMIN2; GRANT ALL PRIVILEGES ON mqtt_subscription_history TO ADMIN2; COMMIT WORK;
Grant rights to an integration table
Warning Do NOT grant alter or delete rights, because integration tables must only be created and deleted through API actions such as "createIntegrationTable" and "deleteIntegrationTable".
- Click the SQL Scripts tab.
- Paste the following script into the textbox to allow the specified user to read (select) and insert records into the specified table. Change table1 to a new integration table name of your choice and user1 to a username of your choice. To only grant read rights, only grant the select right
grant select on admin.itable1 to user1; grant insert on admin.itable1 to user1; commit;
- Click Run All.
- Repeat Step 1 through Step 3 to grant rights to any additional integration tables.
Caution Use this sample grant update command only if you want to allow an account to modify collected data.
grant update on admin.table1 to user1;