Hi there!
We need to do some automatic actions whenever a new device gets registered, which we accomplish by listening to Notifications2 from a microservice. We were able to run it on our local test (with our admin user credentials), but when deploying it to the cumulocity servers, some permissions problems arise:
- If we use PER_TENANT, the service user automatically created, does not receive the notifications for the new devices. This user also cannot access to any previously created device’ MO. This is because this user does not have access to the inventory root. We wanted to fix it, but it looks like it’s impossible to grant access to the inventory root (0), not from within the microservice nor from outside: the service user does not appear in the Users list, not in the UI or using the c8y CLI.
- If we use MULTI_TENANT, the bootstrap service user also does not have any permission on the tenant’s managed object and, as before, also cannot modify it’s own inventory assigned roles.
What should be the best practice here?
We have 2 options to test, but not sure if it’s a good practice or not:
- Dedicated technical user: create a new user and assign the roles and inventory roles it needs to perform the task. In the microservice, only assign the role to access tenant options to get the technical user credentials. Once those are retrieved, logout and login with those credentials and perform the normal activity.
- Change the design: instead of using Notifications2, provide an endpoint from the microservice, so the device, after registration, asks the microservice to do the initial automatic tasks. This would be sub-optimal: depends on the device to do an immportant job.
Is there any other option we have not yet considered?
Thanks in advance!