workos 5.2.0 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/workos/sso.rb +2 -2
- data/lib/workos/types/provider.rb +1 -0
- data/lib/workos/user_management.rb +5 -3
- data/lib/workos/version.rb +1 -1
- data/spec/lib/workos/user_management_spec.rb +27 -0
- data/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml +82 -0
- data/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml +83 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e386ae2dd110ea57c1a5c8d15c09c68263dedbee77c6ffa015b84a952d88920
|
4
|
+
data.tar.gz: e5001300c2da182fd3a230e66c7ced29ef937c8f0774cbd51d1f4e8bc9b8ee45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7882eb8eaef394157785a2592bcb616fa2bd4a7b9015b0b8b37c203ea70ccf43b72c5eb10bbde9155938154d9fc3a2ab5f1e630330efd2eeb53f2672bea65fe
|
7
|
+
data.tar.gz: 0fb86220b0b5fe4dbbcdaa24b35586348d961a40c1628b5eebf44926e7c0a0350ea538b3dcc9610e073c654c65ab5f7d9ada0edb4196bc93b8d9994a3739c7f2
|
data/Gemfile.lock
CHANGED
data/lib/workos/sso.rb
CHANGED
@@ -28,8 +28,8 @@ module WorkOS
|
|
28
28
|
# connection, or organization is required.
|
29
29
|
# The domain is deprecated.
|
30
30
|
# @param [String] provider A provider name for an Identity Provider
|
31
|
-
# configured on your WorkOS dashboard. Only '
|
32
|
-
#
|
31
|
+
# configured on your WorkOS dashboard. Only 'AppleOAuth', 'GitHubOAuth',
|
32
|
+
# 'GoogleOAuth', and 'MicrosoftOAuth' are supported.
|
33
33
|
# @param [String] connection The ID for a Connection configured on
|
34
34
|
# WorkOS.
|
35
35
|
# @param [String] organization The ID for an Organization configured
|
@@ -13,6 +13,7 @@ module WorkOS
|
|
13
13
|
# The ProviderEnum is a declaration of a
|
14
14
|
# fixed set of values for User Management Providers.
|
15
15
|
class Provider
|
16
|
+
Apple = 'AppleOAuth'
|
16
17
|
GitHub = 'GitHubOAuth'
|
17
18
|
Google = 'GoogleOAuth'
|
18
19
|
Microsoft = 'MicrosoftOAuth'
|
@@ -44,7 +45,8 @@ module WorkOS
|
|
44
45
|
# configured redirect URI on your WorkOS dashboard.
|
45
46
|
# @param [String] client_id This value can be obtained from the API Keys page in the WorkOS dashboard.
|
46
47
|
# @param [String] provider A provider name is used to initiate SSO using an
|
47
|
-
# OAuth-compatible provider. Only 'authkit ,'
|
48
|
+
# OAuth-compatible provider. Only 'authkit', 'AppleOAuth', 'GitHubOAuth', 'GoogleOAuth',
|
49
|
+
# and 'MicrosoftOAuth' are supported.
|
48
50
|
# @param [String] connection_id The ID for a Connection configured on
|
49
51
|
# WorkOS.
|
50
52
|
# @param [String] organization_id The organization_id selector is used to
|
@@ -866,11 +868,11 @@ module WorkOS
|
|
866
868
|
# @param [String] role_slug The slug of the role to grant to this membership.
|
867
869
|
#
|
868
870
|
# @return [WorkOS::OrganizationMembership]
|
869
|
-
def update_organization_membership(
|
871
|
+
def update_organization_membership(id:, role_slug:)
|
870
872
|
request = put_request(
|
871
873
|
path: "/user_management/organization_memberships/#{id}",
|
872
874
|
body: {
|
873
|
-
|
875
|
+
id: id,
|
874
876
|
role_slug: role_slug,
|
875
877
|
},
|
876
878
|
auth: true,
|
data/lib/workos/version.rb
CHANGED
@@ -1074,6 +1074,33 @@ describe WorkOS::UserManagement do
|
|
1074
1074
|
end
|
1075
1075
|
end
|
1076
1076
|
|
1077
|
+
describe '.update_organization_membership' do
|
1078
|
+
context 'with a valid id' do
|
1079
|
+
it 'returns true' do
|
1080
|
+
VCR.use_cassette('user_management/update_organization_membership/valid') do
|
1081
|
+
organization_membership = WorkOS::UserManagement.update_organization_membership(
|
1082
|
+
id: 'om_01H5JQDV7R7ATEYZDEG0W5PRYS',
|
1083
|
+
role_slug: 'admin',
|
1084
|
+
)
|
1085
|
+
|
1086
|
+
expect(organization_membership.organization_id).to eq('organization_01H5JQDV7R7ATEYZDEG0W5PRYS')
|
1087
|
+
expect(organization_membership.user_id).to eq('user_01H5JQDV7R7ATEYZDEG0W5PRYS')
|
1088
|
+
expect(organization_membership.role).to eq({ slug: 'admin' })
|
1089
|
+
end
|
1090
|
+
end
|
1091
|
+
end
|
1092
|
+
|
1093
|
+
context 'with an invalid id' do
|
1094
|
+
it 'raises an error' do
|
1095
|
+
VCR.use_cassette('user_management/update_organization_membership/invalid') do
|
1096
|
+
expect do
|
1097
|
+
WorkOS::UserManagement.update_organization_membership(id: 'invalid', role_slug: 'admin')
|
1098
|
+
end.to raise_error(WorkOS::NotFoundError, /Organization Membership not found/)
|
1099
|
+
end
|
1100
|
+
end
|
1101
|
+
end
|
1102
|
+
end
|
1103
|
+
|
1077
1104
|
describe '.delete_organization_membership' do
|
1078
1105
|
context 'with a valid id' do
|
1079
1106
|
it 'returns true' do
|
data/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://api.workos.com/user_management/organization_memberships/invalid
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: '{"id":"invalid","role_slug":"admin"}'
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/json
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
User-Agent:
|
17
|
+
- WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0
|
18
|
+
Authorization:
|
19
|
+
- Bearer <API_KEY>
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 404
|
23
|
+
message: Not Found
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Wed, 15 May 2024 19:13:06 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Cf-Ray:
|
34
|
+
- 7fc6fbe4ef26ec80-SEA
|
35
|
+
Cf-Cache-Status:
|
36
|
+
- DYNAMIC
|
37
|
+
Etag:
|
38
|
+
- W/"58-5GtYccQgavNavjEU+gaKkOl1gq4"
|
39
|
+
Strict-Transport-Security:
|
40
|
+
- max-age=15552000; includeSubDomains
|
41
|
+
Vary:
|
42
|
+
- Origin, Accept-Encoding
|
43
|
+
Via:
|
44
|
+
- 1.1 spaces-router (devel)
|
45
|
+
Access-Control-Allow-Credentials:
|
46
|
+
- 'true'
|
47
|
+
Content-Security-Policy:
|
48
|
+
- 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
|
49
|
+
https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
|
50
|
+
''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
|
51
|
+
Expect-Ct:
|
52
|
+
- max-age=0
|
53
|
+
Referrer-Policy:
|
54
|
+
- no-referrer
|
55
|
+
X-Content-Type-Options:
|
56
|
+
- nosniff
|
57
|
+
X-Dns-Prefetch-Control:
|
58
|
+
- 'off'
|
59
|
+
X-Download-Options:
|
60
|
+
- noopen
|
61
|
+
X-Frame-Options:
|
62
|
+
- SAMEORIGIN
|
63
|
+
X-Permitted-Cross-Domain-Policies:
|
64
|
+
- none
|
65
|
+
X-Request-Id:
|
66
|
+
- f3bf3ce2-ed1c-4fdf-9bba-065c2ab4e5e3
|
67
|
+
X-Xss-Protection:
|
68
|
+
- '0'
|
69
|
+
Set-Cookie:
|
70
|
+
- __cf_bm=VyJvcfBZAdCVUhGKRtHsl9enJXaR64T8urur5ClUQWY-1692999527-0-AahBwhyZ59RlA2LkZ5bsanqtnkJWCPSngTzr7vokapEBcsZzjppDl90U6KcM3t3w2iZ0p7uHvZZ5zI0G74Wlmg4=;
|
71
|
+
path=/; expires=Fri, 25-Aug-23 22:08:47 GMT; domain=.workos.com; HttpOnly;
|
72
|
+
Secure; SameSite=None
|
73
|
+
- __cfruid=1a7b02324f49135ba91ab0fc79714ad620549ae5-1692999527; path=/; domain=.workos.com;
|
74
|
+
HttpOnly; Secure; SameSite=None
|
75
|
+
Server:
|
76
|
+
- cloudflare
|
77
|
+
body:
|
78
|
+
encoding: ASCII-8BIT
|
79
|
+
string: '{"message":"Organization Membership not found: ''invalid''.","code":"entity_not_found","entity_id":"invalid"}'
|
80
|
+
http_version:
|
81
|
+
recorded_at: Wed, 15 May 2024 19:13:06 GMT
|
82
|
+
recorded_with: VCR 5.0.0
|
data/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://api.workos.com/user_management/organization_memberships/om_01H5JQDV7R7ATEYZDEG0W5PRYS
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","role_slug":"admin"}'
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/json
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
User-Agent:
|
17
|
+
- WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0
|
18
|
+
Authorization:
|
19
|
+
- Bearer <API_KEY>
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Wed, 15 May 2024 19:13:06 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Content-Length:
|
30
|
+
- '335'
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Cf-Ray:
|
34
|
+
- 7f828e50ac5dc41d-EWR
|
35
|
+
Cf-Cache-Status:
|
36
|
+
- DYNAMIC
|
37
|
+
Etag:
|
38
|
+
- W/"14f-2n2KgFcHBXf1Yz7SYqzpAxR3E/E"
|
39
|
+
Strict-Transport-Security:
|
40
|
+
- max-age=15552000; includeSubDomains
|
41
|
+
Vary:
|
42
|
+
- Origin, Accept-Encoding
|
43
|
+
Via:
|
44
|
+
- 1.1 spaces-router (devel)
|
45
|
+
Access-Control-Allow-Credentials:
|
46
|
+
- 'true'
|
47
|
+
Content-Security-Policy:
|
48
|
+
- 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
|
49
|
+
https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
|
50
|
+
''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
|
51
|
+
Expect-Ct:
|
52
|
+
- max-age=0
|
53
|
+
Referrer-Policy:
|
54
|
+
- no-referrer
|
55
|
+
X-Content-Type-Options:
|
56
|
+
- nosniff
|
57
|
+
X-Dns-Prefetch-Control:
|
58
|
+
- 'off'
|
59
|
+
X-Download-Options:
|
60
|
+
- noopen
|
61
|
+
X-Frame-Options:
|
62
|
+
- SAMEORIGIN
|
63
|
+
X-Permitted-Cross-Domain-Policies:
|
64
|
+
- none
|
65
|
+
X-Request-Id:
|
66
|
+
- 8d277b87-b703-40d2-95ac-5f40bf96fcbf
|
67
|
+
X-Xss-Protection:
|
68
|
+
- '0'
|
69
|
+
Set-Cookie:
|
70
|
+
- __cf_bm=Pd2y8tPXDzQthhv7HAd93AsNAjT9V0tbWdH6PzS_iyA-1692282007-0-AUsV9W08vMNk02vMMYwMWj3KVIAJtXMGZdhGaWVL9yL3e4S5D1cGL2925nELffPsxoejtsVqyeqdvIixzD7UnL8=;
|
71
|
+
path=/; expires=Thu, 17-Aug-23 14:50:07 GMT; domain=.workos.com; HttpOnly;
|
72
|
+
Secure; SameSite=None
|
73
|
+
- __cfruid=432b4f1724bbd993a76e1e2e8c4d5e2381680fb1-1692282007; path=/; domain=.workos.com;
|
74
|
+
HttpOnly; Secure; SameSite=None
|
75
|
+
Server:
|
76
|
+
- cloudflare
|
77
|
+
body:
|
78
|
+
encoding: UTF-8
|
79
|
+
string: '{"object":"organization_membership","id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","user_id":"user_01H5JQDV7R7ATEYZDEG0W5PRYS","organization_id":"organization_01H5JQDV7R7ATEYZDEG0W5PRYS","status":"active","role":{"slug":"admin"},"created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}'
|
80
|
+
http_version:
|
81
|
+
recorded_at: Wed, 15 May 2024 19:13:06 GMT
|
82
|
+
recorded_with: VCR 5.0.0
|
83
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- WorkOS
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -323,6 +323,8 @@ files:
|
|
323
323
|
- spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml
|
324
324
|
- spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml
|
325
325
|
- spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml
|
326
|
+
- spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml
|
327
|
+
- spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml
|
326
328
|
- spec/support/fixtures/vcr_cassettes/user_management/update_user/invalid.yml
|
327
329
|
- spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml
|
328
330
|
- spec/support/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml
|
@@ -531,6 +533,8 @@ test_files:
|
|
531
533
|
- spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml
|
532
534
|
- spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml
|
533
535
|
- spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml
|
536
|
+
- spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml
|
537
|
+
- spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml
|
534
538
|
- spec/support/fixtures/vcr_cassettes/user_management/update_user/invalid.yml
|
535
539
|
- spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml
|
536
540
|
- spec/support/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml
|