Skip to content

Commit 0a34716

Browse files
feat: include role in the user data inside the request (#478)
1 parent 157f8cd commit 0a34716

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

app/services/forest_liana/token.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def self.create_token(user, rendering_id)
1919
first_name: user['first_name'],
2020
last_name: user['last_name'],
2121
team: user['teams'][0],
22+
role: user['role'],
2223
rendering_id: rendering_id,
2324
exp: expiration_in_seconds()
2425
}, ForestLiana.auth_secret, 'HS256')

spec/requests/authentications_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
describe "GET /authentication/callback" do
4747
before() do
48-
response = '{"data":{"id":666,"attributes":{"first_name":"Alice","last_name":"Doe","email":"[email protected]","teams":[1,2,3]}}}'
48+
response = '{"data":{"id":666,"attributes":{"first_name":"Alice","last_name":"Doe","email":"[email protected]","teams":[1,2,3],"role":"Test"}}}'
4949
allow(ForestLiana::ForestApiRequester).to receive(:get).with(
5050
"/liana/v2/renderings/42/authorization", { :headers => { "forest-token" => "THE-ACCESS-TOKEN" }, :query=> {} }
5151
).and_return(
@@ -72,6 +72,7 @@
7272
"first_name" => 'Alice',
7373
"last_name" => 'Doe',
7474
"team" => 1,
75+
"role" => "Test",
7576
}
7677

7778
expect(decoded).to include(expected_token_data)

0 commit comments

Comments
 (0)