Query Opal’s access graph
accesslib Module
Theaccesslib module provides functions to query Opal’s access graph. Use it to check existing permissions when making automation decisions.
accesslib.check_access(principal_id, entity_id, [access_level_remote_id]) checks whether a principal (user or group) currently has access to an entity (resource or group).
Parameters
The ID of the user or group to check
The ID of the resource or group to check access to
Filter by specific access level (e.g.,
"admin", "viewer") Returns
True if access exists, False otherwise
Examples
Send notifications
notificationslib Module
Thenotificationslib module provides functions to send notifications to users, admins, and owners from within a script.
Notify a user
notificationslib.notify_user(user_id, title, body) sends a notification to a specific user via email and Slack (if configured).
Parameters
The ID of the user to notify
Notification title
Notification body
Returns
True if the notification was sent successfully, False otherwise
Example
Notify all admins
notificationslib.notify_admins(title, body) sends a notification to all Opal admins.
Parameters
Notification title
Notification body
Returns
True if the notification was sent successfully, False otherwise
Example
Notify an owner
notificationslib.notify_owner(owner_id, title, body) sends a notification to an owner. If the owner has a Slack message channel configured, the notification is sent to that channel only. Otherwise it is sent to all individual users in the owner.
Parameters
The ID of the owner to notify
Notification title
Notification body
Returns
True if the notification was sent successfully, False otherwise
Example

