How to access binary with custom inventory role

Product/components used and version/fix level:

Cumulocity Production

Detailed explanation of the problem:

Hi I am have uploaded one binary and I am trying to access that binary through a user who has a custom role. This custom role is basically an inventory role that is assigned to the user so that they can access their particular devices. Now I want all users to be able to access this binary object. How can I achieve this?

Hi,
sounds like you are searching for globally accessible objects:

It is possible to make any object accessible by any user without specific rights. To grant those rights just add a new fragment called c8y_Global to the object.

Hi, It is not working. My user is able to fetch the managed object but when I am trying to retrieve the binary with this URL:
{{url}}/inventory/binaries/:id I am getting access denied

I have added c8y_Global as well.
image

That’s unexpected to me. I’ve just tested with a User having Inventory Roles setup to access only a particular set of Devices. This user was able to get both: the Managed Object via the Inventory API + the File via /inventory/binaries/{id}.

Questions:

  • But you can access this file with an admin user via API, right?
  • Which exact roles does this user have?
  • Can you try to upload a new File via UI (Administration > Management > File Repository) and try to access this file?

Hi, I just tested it with other files that I uploaded earlier. I noticed that those files have c8y_Global by default and my test user is able to access those files but when I updated my M.O. by adding this fragment it is not able to access it. I tried uploading with Files Repository, but I didn’t get the global fragment by default. Can you please tell me how can I get this role by default?

Hi, So what I did is I added the c8y_Global fragment in the object param i.e. while uploading the file in binary.

{“name”:“name”,“type”:“image/jpeg”,“c8y_Global”:{}}

It can be done like this and the user will be able to fetch the binary.

Thanks,
Samanyu

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.