Skip to main content
The script checks every app in the AppStore.
Python

Prepare the request

The script reads your API token from the LUMOS_API_TOKEN environment variable, so the token never appears in the code. Create the token as a user with the Admin role. A token reads only what its user can, as What a token is allowed to do describes. The script uses Python 3 and the requests library (pip install requests).
get() sends each request and handles two failures itself. When a response is a 429, meaning you’re over the rate limit, it waits the number of seconds in the Retry-After header, then tries again. A 404 returns None, which the script reads as “not there”. Any other error raises and stops the script.

Find the AppStore apps

List Apps with in_app_store=true returns every app in the AppStore, whatever its catalog_visibility. The loop pages through them as Pagination describes.

Read each app’s admins

Get App Admins returns the users and groups that administer the app. The script checks the users.

Read each app’s approvers

Get App Approval Workflow returns the workflow bound to the app. An approval workflow holds one branch step, whose branches name approval-chain workflows. The chains hold the approvers, as Approval workflows describes. The script reads each chain with Get Workflow and keeps the assignees whose type is user. Get App Approval Workflow returns 404 when no approval workflow is bound to the app, and when the bound workflow has steps the API can’t represent. Without a bound workflow, Lumos uses the app’s approval settings in the Lumos UI, which v1 doesn’t return. The script lists these apps at the end, so you can check their approvers in the Lumos UI.

Check each user

Get User returns the user’s status, which is one of staged, active, suspended, or inactive. The script reports every user whose status isn’t active. It also reports a user that Get User returns 404 for, which means Lumos removed them from your organization, with the status removed.

What the script doesn’t check

The script checks only users that an app names directly. It skips these:
  • Groups. An inactive user who approves or administers an app through a group isn’t listed, and neither is a group with no active members.
  • Approvers that Lumos works out for each request, such as the requester’s manager or the app’s admins.
  • Entitlements’ own approval workflows, which Get Entitlement Approval Workflow Override returns.