User listing including role and what sites and asset groups they have access to

Does anyone happen to have a SQL query or API script to pull the Users and what sites and asset groups they have access to? I can’t imagine I am the only one needing this information for auditing purposes.

Thanks!

Hey @lora_fulton, I don’t see anything immediately in the reporting data model for SQL reports for this - perhaps I’m missing something - however, it is certainly possible to use the API.

There are a couple requests you would need to use:

  1. Get Users (pages response)
    i. Endpoint: GET /api/3/users
    ii. API Documentation
    iii. Details: Returns paged response of users and contains user details, if they have access to all sites/asset groups, and if they are a global admin
  2. Get User Site Access
    i. Endpoint: GET /api/3/users/{id}/sites
    ii. API Documentation
    iii. Details: Returns a list of Site IDs the user has access to
  3. Get User Asset Group Access
    i. Endpoint: GET /api/3/users/{id}/asset_groups
    ii. API Documentation
    iii. Details: Returns a list of Asset Group IDs the user has access to

Hopefully someone out in the community has a script already put together for this but at the very least these endpoints should get you heading in the right direction!