Skip to content

Update CSS for SSO #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ruby-admin-portal-example/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ source 'https://rubygems.org'

gem 'dotenv', '2.7.6'
gem 'sinatra', '2.2.0'
gem 'workos', '2.5.0'
gem 'workos', '2.12.0'
17 changes: 15 additions & 2 deletions ruby-audit-logs-example/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ruby-audit-logs-example

An example Ruby application demonstrating how to use the [WorkOS Ruby SDK](https://github.com/workos/workos-ruby) 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.
An example Ruby application demonstrating how to use the [WorkOS Ruby SDK](https://github.com/workos/workos-ruby) 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 Ruby SDK.

## Clone and Install

Expand All @@ -10,7 +10,6 @@ An example Ruby application demonstrating how to use the [WorkOS Ruby SDK](https
# HTTPS
$ git clone https://github.com/workos/ruby-example-applications.git
```


2. Navigate to the Audit Logs example app within the cloned repo and install dependencies:

Expand Down Expand Up @@ -40,10 +39,24 @@ Action title: "user.connection_deleted" | Target type: "team"
4. 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.

## Run the app

```sh
ruby app.rb
```

## Audit Logs Setup with WorkOS

5. 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:

Action title: "user.organization_set" | Target type: "team"
Action title: "user.organization_deleted" | Target type: "team"

6. Configure the Admin Portal Redirect URI.

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.

7. 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.

## Need help?

If you get stuck and aren't able to resolve the issue by reading our API reference or tutorials, you can reach out to us at [email protected] and we'll lend a hand.
2 changes: 0 additions & 2 deletions ruby-audit-logs-example/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
require 'sinatra'
require 'workos'
require 'date'
require_relative 'audit_log_events.rb'
require 'pry'

# Pull API key and Client ID from ENV variable
WorkOS.key = ENV['WORKOS_API_KEY']
Expand Down
96 changes: 0 additions & 96 deletions ruby-audit-logs-example/audit_log_events.rb

This file was deleted.

7 changes: 0 additions & 7 deletions ruby-audit-logs-example/views/login.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
<html>

<head>
<link rel="stylesheet" href="{{ url_for('static', filename='login.css')}}">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter">
</head>

<body class="container_success">

<div class="logged_in_div_left flex_column">
Expand Down
12 changes: 6 additions & 6 deletions ruby-directory-sync-example/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
daemons (1.4.1)
dotenv (2.7.6)
em-websocket (0.3.8)
Expand All @@ -11,8 +11,8 @@ GEM
eventmachine (1.2.7)
mustermann (1.1.2)
ruby2_keywords (~> 0.0.1)
public_suffix (4.0.7)
rack (2.2.4)
public_suffix (5.0.1)
rack (2.2.6.4)
rack-protection (2.2.0)
rack
ruby2_keywords (0.0.5)
Expand All @@ -25,12 +25,12 @@ GEM
em-websocket (~> 0.3.6)
eventmachine
thin (>= 1.3.1, < 2.0.0)
sorbet-runtime (0.5.10274)
sorbet-runtime (0.5.10741)
thin (1.8.1)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
tilt (2.0.11)
tilt (2.1.0)
workos (2.5.0)
sorbet-runtime (~> 0.5)

Expand Down
35 changes: 30 additions & 5 deletions ruby-directory-sync-example/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,46 @@
require 'workos'
require 'json'
require 'sinatra-websocket'
require 'pry'

set :server, 'thin'
set :sockets, []

# Pull API key from ENV variable
WorkOS.key = ENV['WORKOS_API_KEY']

get '/' do
@directories_list = WorkOS::DirectorySync.list_directories
@directories = @directories_list.data
enable :sessions

use(
Rack::Session::Cookie,
key: 'rack.session',
domain: 'localhost',
path: '/',
expire_after: 2_592_000,
secret: SecureRandom.hex(16)
)

get '/' do
before = params[:before]
after = params[:after]
puts before
puts after
if !before
@directories = WorkOS::DirectorySync.list_directories(
limit: 5
)
else
@directories = WorkOS::DirectorySync.list_directories(
limit: 5,
before: before,
after: after
)
end
@before = @directories.list_metadata["before"]
@after = @directories.list_metadata["after"]
erb :index, :layout => false
end


get '/directories/:id' do
@groups_list = WorkOS::DirectorySync.list_groups(directory: params[:id])
@groups = @groups_list.data
Expand All @@ -32,7 +57,7 @@

get '/users/:id' do
@user = WorkOS::DirectorySync.get_user(params[:id])
@user_groups_list = WorkOS::DirectorySync.list_groups(user: params[:id])
@user_groups_list = WorkOS::DirectorySync.list_groups(user: params[:id], limit: 5)
@user_groups = @user_groups_list.data

erb :user
Expand Down
1 change: 1 addition & 0 deletions ruby-directory-sync-example/public/images/settings-2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading