Skip to content

Commit 6ca28fd

Browse files
awolfdenAdam Wolfman
andauthored
Update Audit Logs example app (#55)
* Update all versions and add dsync pagination * Add pagination to audit logs app * Update Audit Logs app with new design * Clean up print statments and unused imports Co-authored-by: Adam Wolfman <[email protected]>
1 parent 5dbc93e commit 6ca28fd

File tree

28 files changed

+1164
-749
lines changed

28 files changed

+1164
-749
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.formatting.provider": "black"
3+
}

python-django-admin-portal-example/workos_django/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ pytz==2021.1
77
requests==2.25.1
88
sqlparse==0.4.2
99
urllib3==1.26.5
10-
workos==1.20.2
10+
workos>=1.21.0
1111
python-dotenv

python-django-audit-logs-example/README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# python-django-audit-logs-example
22

3-
An example Django application demonstrating how to use the [WorkOS Python SDK](https://github.com/workos/workos-python) to send and retrieve Audit Log events. This example is not meant to show a real-world example of an Audit Logs implementation, but rather to show concrete examples of how events can be sent using the Python SDK.
3+
An example Django application demonstrating how to use the [WorkOS Python SDK](https://github.com/workos/workos-python) to send and retrieve Audit Log events.
44

55
## Prerequisites
66

@@ -112,25 +112,22 @@ Starting development server at http://127.0.0.1:8000/
112112
Quit the server with CONTROL-C.
113113
```
114114

115-
Navigate to `localhost:8000` in your web browser. You should see a place to enter your organization ID. This can be found in the WorkOS Dashboard for the Organization you'd like to send logs to.
115+
Navigate to `localhost:8000` in your web browser. You will see a list of your organizations. Click one to get started.
116116

117117
You can stop the local Django server for now by entering `CTRL + c` on the command line.
118118

119119
### Audit Logs Setup with WorkOS
120120

121-
11. Follow the [Audit Logs configuration steps](https://workos.com/docs/audit-logs/emit-an-audit-log-event/sign-in-to-your-workos-dashboard-account-and-configure-audit-log-event-schemas) to set up the following 5 events that are sent with this example:
121+
11. Follow the [Audit Logs configuration steps](https://workos.com/docs/audit-logs/emit-an-audit-log-event/sign-in-to-your-workos-dashboard-account-and-configure-audit-log-event-schemas) to set up the following 2 events that are sent with this example:
122122

123-
Action title: "user.signed_in" | Target type: "team"
124-
Action title: "user.logged_out" | Target type: "team"
125123
Action title: "user.organization_set" | Target type: "team"
126124
Action title: "user.organization_deleted" | Target type: "team"
127-
Action title: "user.connection_deleted" | Target type: "team"
128125

129-
12. Next, take note of the Organization ID for the Org which you will be sending the Audit Log events for. This ID gets entered into the splash page of the example application.
126+
12. Configure the Admin Portal Redirect URI.
130127

131-
13. Once you enter the Organization ID and submit it, you will be brought to the page where you'll be able to send the audit log events that were just configured. You'll also notice that the action of setting the Organization triggered an Audit Log already. Click the buttons to send the respective events.
128+
Navigate to the Configuration tab in your WorkOS Dshboard. From there click the Admin Portal tab. Click the Edit Admin Portal Redirect Links button and add "http://localhost:8000" to the "When clicking the back navigation, return users to:" input, then click Save Redirect Links.
132129

133-
14. To obtain a CSV of the Audit Log events that were sent for the last 30 days, click the "Export Events" button. This will bring you to a new page where you can download the events. Downloading the events is a 2 step process. First you need to create the report by clicking the "Generate CSV" button. Then click the "Access CSV" button to download a CSV of the Audit Log events for the selected Organization for the past 30 days.
130+
13. To obtain a CSV of the Audit Log events that were sent for the last 30 days, click the "Export Events" tab. This will bring you to a new page where you can download the events. Downloading the events is a 2 step process. First you need to create the report by clicking the "Generate CSV" button. Then click the "Access CSV" button to download a CSV of the Audit Log events for the selected Organization for the past 30 days. You may also adjust the time range using the form inputs.
134131

135132
## Need help?
136133

0 commit comments

Comments
 (0)