workos 7.1.0 → 7.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.oagen-manifest.json +1 -1
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +16 -0
- data/Gemfile.lock +2 -2
- data/lib/workos/api_keys.rb +1 -1
- data/lib/workos/audit_logs.rb +2 -2
- data/lib/workos/authorization.rb +128 -116
- data/lib/workos/base_client.rb +6 -1
- data/lib/workos/encryptors/aes_gcm.rb +35 -3
- data/lib/workos/groups.rb +1 -1
- data/lib/workos/multi_factor_auth.rb +1 -1
- data/lib/workos/organization_domains.rb +1 -1
- data/lib/workos/radar.rb +2 -2
- data/lib/workos/session.rb +16 -5
- data/lib/workos/sso.rb +2 -2
- data/lib/workos/user_management.rb +74 -65
- data/lib/workos/version.rb +1 -1
- data/lib/workos/webhooks.rb +1 -1
- data/rbi/workos/authorization.rbi +100 -26
- data/rbi/workos/user_management.rbi +60 -14
- data/test/workos/test_audit_logs.rb +2 -2
- data/test/workos/test_authorization.rb +86 -20
- data/test/workos/test_encryptors_aes_gcm.rb +21 -0
- data/test/workos/test_session.rb +193 -0
- data/test/workos/test_user_management.rb +44 -8
- data/test/workos/test_webhooks.rb +2 -2
- metadata +2 -2
data/lib/workos/session.rb
CHANGED
|
@@ -90,18 +90,27 @@ module WorkOS
|
|
|
90
90
|
body = {
|
|
91
91
|
"grant_type" => "refresh_token",
|
|
92
92
|
"client_id" => @client.client_id,
|
|
93
|
-
"refresh_token" => session["refresh_token"]
|
|
94
|
-
"session" => {"seal_session" => true, "cookie_password" => effective_password}
|
|
93
|
+
"refresh_token" => session["refresh_token"]
|
|
95
94
|
}
|
|
96
95
|
body["organization_id"] = organization_id if organization_id
|
|
97
96
|
|
|
98
97
|
response = @client.request(method: :post, path: "/user_management/authenticate", auth: true, body: body)
|
|
99
98
|
auth_response = JSON.parse(response.body)
|
|
100
|
-
sealed = auth_response["sealed_session"].to_s
|
|
101
|
-
@seal_data = sealed
|
|
102
|
-
@cookie_password = effective_password
|
|
103
99
|
|
|
100
|
+
sealed = @manager.seal_session_from_auth_response(
|
|
101
|
+
access_token: auth_response["access_token"],
|
|
102
|
+
refresh_token: auth_response["refresh_token"],
|
|
103
|
+
cookie_password: effective_password,
|
|
104
|
+
user: auth_response["user"],
|
|
105
|
+
impersonator: auth_response["impersonator"]
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
# Decode before mutating session state so a malformed access_token
|
|
109
|
+
# doesn't leave the Session half-updated.
|
|
104
110
|
decoded = @manager.decode_jwt(auth_response["access_token"])
|
|
111
|
+
|
|
112
|
+
@seal_data = sealed
|
|
113
|
+
@cookie_password = effective_password
|
|
105
114
|
SessionManager::RefreshSuccess.new(
|
|
106
115
|
authenticated: true,
|
|
107
116
|
sealed_session: sealed,
|
|
@@ -117,6 +126,8 @@ module WorkOS
|
|
|
117
126
|
)
|
|
118
127
|
rescue WorkOS::AuthenticationError, WorkOS::InvalidRequestError => e
|
|
119
128
|
SessionManager::RefreshError.new(authenticated: false, reason: e.message)
|
|
129
|
+
rescue JWT::DecodeError => e
|
|
130
|
+
SessionManager::RefreshError.new(authenticated: false, reason: e.message)
|
|
120
131
|
end
|
|
121
132
|
|
|
122
133
|
# Build the WorkOS session-logout URL for the currently authenticated session.
|
data/lib/workos/sso.rb
CHANGED
|
@@ -116,7 +116,7 @@ module WorkOS
|
|
|
116
116
|
)
|
|
117
117
|
body = {
|
|
118
118
|
"profile_id" => profile_id
|
|
119
|
-
}
|
|
119
|
+
}
|
|
120
120
|
response = @client.request(
|
|
121
121
|
method: :post,
|
|
122
122
|
path: "/sso/logout/authorize",
|
|
@@ -157,7 +157,7 @@ module WorkOS
|
|
|
157
157
|
"client_id" => request_options[:client_id] || @client.client_id,
|
|
158
158
|
"client_secret" => request_options[:api_key] || @client.api_key,
|
|
159
159
|
"code" => code
|
|
160
|
-
}
|
|
160
|
+
}
|
|
161
161
|
response = @client.request(
|
|
162
162
|
method: :post,
|
|
163
163
|
path: "/sso/token",
|
|
@@ -6,6 +6,32 @@ require "json"
|
|
|
6
6
|
|
|
7
7
|
module WorkOS
|
|
8
8
|
class UserManagement
|
|
9
|
+
# Identifies the password (plaintext variant).
|
|
10
|
+
#
|
|
11
|
+
# @!attribute [r] password
|
|
12
|
+
# @return [String]
|
|
13
|
+
PasswordPlaintext = Data.define(:password)
|
|
14
|
+
|
|
15
|
+
# Identifies the password (hashed variant).
|
|
16
|
+
#
|
|
17
|
+
# @!attribute [r] password_hash
|
|
18
|
+
# @return [String]
|
|
19
|
+
# @!attribute [r] password_hash_type
|
|
20
|
+
# @return [WorkOS::Types::CreateUserPasswordHashType]
|
|
21
|
+
PasswordHashed = Data.define(:password_hash, :password_hash_type)
|
|
22
|
+
|
|
23
|
+
# Identifies the role (single variant).
|
|
24
|
+
#
|
|
25
|
+
# @!attribute [r] role_slug
|
|
26
|
+
# @return [String]
|
|
27
|
+
RoleSingle = Data.define(:role_slug)
|
|
28
|
+
|
|
29
|
+
# Identifies the role (multiple variant).
|
|
30
|
+
#
|
|
31
|
+
# @!attribute [r] role_slugs
|
|
32
|
+
# @return [Array<String>]
|
|
33
|
+
RoleMultiple = Data.define(:role_slugs)
|
|
34
|
+
|
|
9
35
|
def initialize(client)
|
|
10
36
|
@client = client
|
|
11
37
|
end
|
|
@@ -403,7 +429,7 @@ module WorkOS
|
|
|
403
429
|
)
|
|
404
430
|
body = {
|
|
405
431
|
"client_id" => client_id
|
|
406
|
-
}
|
|
432
|
+
}
|
|
407
433
|
response = @client.request(
|
|
408
434
|
method: :post,
|
|
409
435
|
path: "/user_management/authorize/device",
|
|
@@ -450,7 +476,7 @@ module WorkOS
|
|
|
450
476
|
)
|
|
451
477
|
body = {
|
|
452
478
|
"origin" => origin
|
|
453
|
-
}
|
|
479
|
+
}
|
|
454
480
|
response = @client.request(
|
|
455
481
|
method: :post,
|
|
456
482
|
path: "/user_management/cors_origins",
|
|
@@ -492,7 +518,7 @@ module WorkOS
|
|
|
492
518
|
)
|
|
493
519
|
body = {
|
|
494
520
|
"email" => email
|
|
495
|
-
}
|
|
521
|
+
}
|
|
496
522
|
response = @client.request(
|
|
497
523
|
method: :post,
|
|
498
524
|
path: "/user_management/password_reset",
|
|
@@ -518,7 +544,7 @@ module WorkOS
|
|
|
518
544
|
body = {
|
|
519
545
|
"token" => token,
|
|
520
546
|
"new_password" => new_password
|
|
521
|
-
}
|
|
547
|
+
}
|
|
522
548
|
response = @client.request(
|
|
523
549
|
method: :post,
|
|
524
550
|
path: "/user_management/password_reset/confirm",
|
|
@@ -613,9 +639,7 @@ module WorkOS
|
|
|
613
639
|
# @param email_verified [Boolean, nil] Whether the user's email has been verified.
|
|
614
640
|
# @param metadata [Hash{String => String}, nil] Object containing metadata key/value pairs associated with the user.
|
|
615
641
|
# @param external_id [String, nil] The external ID of the user.
|
|
616
|
-
# @param password [
|
|
617
|
-
# @param password_hash [String, nil] The hashed password to set for the user. Required with `password_hash_type`. Mutually exclusive with `password`.
|
|
618
|
-
# @param password_hash_type [WorkOS::Types::CreateUserPasswordHashType, nil] The algorithm originally used to hash the password, used when providing a `password_hash`. Required with `password_hash`. Mutually exclusive with `password`.
|
|
642
|
+
# @param password [WorkOS::UserManagement::PasswordPlaintext, WorkOS::UserManagement::PasswordHashed, nil] Identifies the password.
|
|
619
643
|
# @param request_options [Hash] (see WorkOS::Types::RequestOptions)
|
|
620
644
|
# @return [WorkOS::User]
|
|
621
645
|
def create_user(
|
|
@@ -626,8 +650,6 @@ module WorkOS
|
|
|
626
650
|
metadata: nil,
|
|
627
651
|
external_id: nil,
|
|
628
652
|
password: nil,
|
|
629
|
-
password_hash: nil,
|
|
630
|
-
password_hash_type: nil,
|
|
631
653
|
request_options: {}
|
|
632
654
|
)
|
|
633
655
|
body = {
|
|
@@ -636,18 +658,17 @@ module WorkOS
|
|
|
636
658
|
"last_name" => last_name,
|
|
637
659
|
"email_verified" => email_verified,
|
|
638
660
|
"metadata" => metadata,
|
|
639
|
-
"external_id" => external_id
|
|
640
|
-
"password" => password,
|
|
641
|
-
"password_hash" => password_hash,
|
|
642
|
-
"password_hash_type" => password_hash_type
|
|
661
|
+
"external_id" => external_id
|
|
643
662
|
}.compact
|
|
644
663
|
if password
|
|
645
|
-
case password
|
|
646
|
-
when
|
|
647
|
-
body["password"] = password
|
|
648
|
-
when
|
|
649
|
-
body["password_hash"] = password
|
|
650
|
-
body["password_hash_type"] = password
|
|
664
|
+
case password
|
|
665
|
+
when WorkOS::UserManagement::PasswordPlaintext
|
|
666
|
+
body["password"] = password.password
|
|
667
|
+
when WorkOS::UserManagement::PasswordHashed
|
|
668
|
+
body["password_hash"] = password.password_hash
|
|
669
|
+
body["password_hash_type"] = password.password_hash_type
|
|
670
|
+
else
|
|
671
|
+
raise ArgumentError, "expected password to be one of: WorkOS::UserManagement::PasswordPlaintext, WorkOS::UserManagement::PasswordHashed, got #{password.class}"
|
|
651
672
|
end
|
|
652
673
|
end
|
|
653
674
|
response = @client.request(
|
|
@@ -709,9 +730,7 @@ module WorkOS
|
|
|
709
730
|
# @param metadata [Hash{String => String}, nil] Object containing metadata key/value pairs associated with the user.
|
|
710
731
|
# @param external_id [String, nil] The external ID of the user.
|
|
711
732
|
# @param locale [String, nil] The user's preferred locale.
|
|
712
|
-
# @param password [
|
|
713
|
-
# @param password_hash [String, nil] The hashed password to set for the user. Required with `password_hash_type`. Mutually exclusive with `password`.
|
|
714
|
-
# @param password_hash_type [WorkOS::Types::UpdateUserPasswordHashType, nil] The algorithm originally used to hash the password, used when providing a `password_hash`. Required with `password_hash`. Mutually exclusive with `password`.
|
|
733
|
+
# @param password [WorkOS::UserManagement::PasswordPlaintext, WorkOS::UserManagement::PasswordHashed, nil] Identifies the password.
|
|
715
734
|
# @param request_options [Hash] (see WorkOS::Types::RequestOptions)
|
|
716
735
|
# @return [WorkOS::User]
|
|
717
736
|
def update_user(
|
|
@@ -724,8 +743,6 @@ module WorkOS
|
|
|
724
743
|
external_id: nil,
|
|
725
744
|
locale: nil,
|
|
726
745
|
password: nil,
|
|
727
|
-
password_hash: nil,
|
|
728
|
-
password_hash_type: nil,
|
|
729
746
|
request_options: {}
|
|
730
747
|
)
|
|
731
748
|
body = {
|
|
@@ -735,18 +752,17 @@ module WorkOS
|
|
|
735
752
|
"email_verified" => email_verified,
|
|
736
753
|
"metadata" => metadata,
|
|
737
754
|
"external_id" => external_id,
|
|
738
|
-
"locale" => locale
|
|
739
|
-
"password" => password,
|
|
740
|
-
"password_hash" => password_hash,
|
|
741
|
-
"password_hash_type" => password_hash_type
|
|
755
|
+
"locale" => locale
|
|
742
756
|
}.compact
|
|
743
757
|
if password
|
|
744
|
-
case password
|
|
745
|
-
when
|
|
746
|
-
body["password"] = password
|
|
747
|
-
when
|
|
748
|
-
body["password_hash"] = password
|
|
749
|
-
body["password_hash_type"] = password
|
|
758
|
+
case password
|
|
759
|
+
when WorkOS::UserManagement::PasswordPlaintext
|
|
760
|
+
body["password"] = password.password
|
|
761
|
+
when WorkOS::UserManagement::PasswordHashed
|
|
762
|
+
body["password_hash"] = password.password_hash
|
|
763
|
+
body["password_hash_type"] = password.password_hash_type
|
|
764
|
+
else
|
|
765
|
+
raise ArgumentError, "expected password to be one of: WorkOS::UserManagement::PasswordPlaintext, WorkOS::UserManagement::PasswordHashed, got #{password.class}"
|
|
750
766
|
end
|
|
751
767
|
end
|
|
752
768
|
response = @client.request(
|
|
@@ -790,7 +806,7 @@ module WorkOS
|
|
|
790
806
|
)
|
|
791
807
|
body = {
|
|
792
808
|
"code" => code
|
|
793
|
-
}
|
|
809
|
+
}
|
|
794
810
|
response = @client.request(
|
|
795
811
|
method: :post,
|
|
796
812
|
path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_change/confirm",
|
|
@@ -815,7 +831,7 @@ module WorkOS
|
|
|
815
831
|
)
|
|
816
832
|
body = {
|
|
817
833
|
"new_email" => new_email
|
|
818
|
-
}
|
|
834
|
+
}
|
|
819
835
|
response = @client.request(
|
|
820
836
|
method: :post,
|
|
821
837
|
path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_change/send",
|
|
@@ -840,7 +856,7 @@ module WorkOS
|
|
|
840
856
|
)
|
|
841
857
|
body = {
|
|
842
858
|
"code" => code
|
|
843
|
-
}
|
|
859
|
+
}
|
|
844
860
|
response = @client.request(
|
|
845
861
|
method: :post,
|
|
846
862
|
path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_verification/confirm",
|
|
@@ -1138,7 +1154,7 @@ module WorkOS
|
|
|
1138
1154
|
)
|
|
1139
1155
|
body = {
|
|
1140
1156
|
"content" => content
|
|
1141
|
-
}
|
|
1157
|
+
}
|
|
1142
1158
|
response = @client.request(
|
|
1143
1159
|
method: :put,
|
|
1144
1160
|
path: "/user_management/jwt_template",
|
|
@@ -1255,30 +1271,27 @@ module WorkOS
|
|
|
1255
1271
|
# Create an organization membership
|
|
1256
1272
|
# @param user_id [String] The ID of the [user](https://workos.com/docs/reference/authkit/user).
|
|
1257
1273
|
# @param organization_id [String] The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to.
|
|
1258
|
-
# @param
|
|
1259
|
-
# @param role_slugs [Array<String>, nil] An array of role identifiers. Limited to one role when Multiple Roles is disabled. Mutually exclusive with `role_slug`.
|
|
1274
|
+
# @param role [WorkOS::UserManagement::RoleSingle, WorkOS::UserManagement::RoleMultiple, nil] Identifies the role.
|
|
1260
1275
|
# @param request_options [Hash] (see WorkOS::Types::RequestOptions)
|
|
1261
1276
|
# @return [WorkOS::OrganizationMembership]
|
|
1262
1277
|
def create_organization_membership(
|
|
1263
1278
|
user_id:,
|
|
1264
1279
|
organization_id:,
|
|
1265
|
-
role_slug: nil,
|
|
1266
|
-
role_slugs: nil,
|
|
1267
1280
|
role: nil,
|
|
1268
1281
|
request_options: {}
|
|
1269
1282
|
)
|
|
1270
1283
|
body = {
|
|
1271
1284
|
"user_id" => user_id,
|
|
1272
|
-
"organization_id" => organization_id
|
|
1273
|
-
|
|
1274
|
-
"role_slugs" => role_slugs
|
|
1275
|
-
}.compact
|
|
1285
|
+
"organization_id" => organization_id
|
|
1286
|
+
}
|
|
1276
1287
|
if role
|
|
1277
|
-
case role
|
|
1278
|
-
when
|
|
1279
|
-
body["role_slug"] = role
|
|
1280
|
-
when
|
|
1281
|
-
body["role_slugs"] = role
|
|
1288
|
+
case role
|
|
1289
|
+
when WorkOS::UserManagement::RoleSingle
|
|
1290
|
+
body["role_slug"] = role.role_slug
|
|
1291
|
+
when WorkOS::UserManagement::RoleMultiple
|
|
1292
|
+
body["role_slugs"] = role.role_slugs
|
|
1293
|
+
else
|
|
1294
|
+
raise ArgumentError, "expected role to be one of: WorkOS::UserManagement::RoleSingle, WorkOS::UserManagement::RoleMultiple, got #{role.class}"
|
|
1282
1295
|
end
|
|
1283
1296
|
end
|
|
1284
1297
|
response = @client.request(
|
|
@@ -1314,27 +1327,23 @@ module WorkOS
|
|
|
1314
1327
|
|
|
1315
1328
|
# Update an organization membership
|
|
1316
1329
|
# @param id [String] The unique ID of the organization membership.
|
|
1317
|
-
# @param
|
|
1318
|
-
# @param role_slugs [Array<String>, nil] An array of role identifiers. Limited to one role when Multiple Roles is disabled. Mutually exclusive with `role_slug`.
|
|
1330
|
+
# @param role [WorkOS::UserManagement::RoleSingle, WorkOS::UserManagement::RoleMultiple, nil] Identifies the role.
|
|
1319
1331
|
# @param request_options [Hash] (see WorkOS::Types::RequestOptions)
|
|
1320
1332
|
# @return [WorkOS::UserOrganizationMembership]
|
|
1321
1333
|
def update_organization_membership(
|
|
1322
1334
|
id:,
|
|
1323
|
-
role_slug: nil,
|
|
1324
|
-
role_slugs: nil,
|
|
1325
1335
|
role: nil,
|
|
1326
1336
|
request_options: {}
|
|
1327
1337
|
)
|
|
1328
|
-
body = {
|
|
1329
|
-
"role_slug" => role_slug,
|
|
1330
|
-
"role_slugs" => role_slugs
|
|
1331
|
-
}.compact
|
|
1338
|
+
body = {}
|
|
1332
1339
|
if role
|
|
1333
|
-
case role
|
|
1334
|
-
when
|
|
1335
|
-
body["role_slug"] = role
|
|
1336
|
-
when
|
|
1337
|
-
body["role_slugs"] = role
|
|
1340
|
+
case role
|
|
1341
|
+
when WorkOS::UserManagement::RoleSingle
|
|
1342
|
+
body["role_slug"] = role.role_slug
|
|
1343
|
+
when WorkOS::UserManagement::RoleMultiple
|
|
1344
|
+
body["role_slugs"] = role.role_slugs
|
|
1345
|
+
else
|
|
1346
|
+
raise ArgumentError, "expected role to be one of: WorkOS::UserManagement::RoleSingle, WorkOS::UserManagement::RoleMultiple, got #{role.class}"
|
|
1338
1347
|
end
|
|
1339
1348
|
end
|
|
1340
1349
|
response = @client.request(
|
|
@@ -1414,7 +1423,7 @@ module WorkOS
|
|
|
1414
1423
|
)
|
|
1415
1424
|
body = {
|
|
1416
1425
|
"uri" => uri
|
|
1417
|
-
}
|
|
1426
|
+
}
|
|
1418
1427
|
response = @client.request(
|
|
1419
1428
|
method: :post,
|
|
1420
1429
|
path: "/user_management/redirect_uris",
|
data/lib/workos/version.rb
CHANGED
data/lib/workos/webhooks.rb
CHANGED
|
@@ -6,6 +6,90 @@
|
|
|
6
6
|
|
|
7
7
|
module WorkOS
|
|
8
8
|
class Authorization
|
|
9
|
+
class ResourceTargetById
|
|
10
|
+
sig { returns(String) }
|
|
11
|
+
def resource_id; end
|
|
12
|
+
|
|
13
|
+
sig do
|
|
14
|
+
params(
|
|
15
|
+
resource_id: String
|
|
16
|
+
).returns(WorkOS::Authorization::ResourceTargetById)
|
|
17
|
+
end
|
|
18
|
+
def self.new(resource_id:); end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class ResourceTargetByExternalId
|
|
22
|
+
sig { returns(String) }
|
|
23
|
+
def resource_external_id; end
|
|
24
|
+
|
|
25
|
+
sig { returns(String) }
|
|
26
|
+
def resource_type_slug; end
|
|
27
|
+
|
|
28
|
+
sig do
|
|
29
|
+
params(
|
|
30
|
+
resource_external_id: String,
|
|
31
|
+
resource_type_slug: String
|
|
32
|
+
).returns(WorkOS::Authorization::ResourceTargetByExternalId)
|
|
33
|
+
end
|
|
34
|
+
def self.new(resource_external_id:, resource_type_slug:); end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class ParentResourceById
|
|
38
|
+
sig { returns(String) }
|
|
39
|
+
def parent_resource_id; end
|
|
40
|
+
|
|
41
|
+
sig do
|
|
42
|
+
params(
|
|
43
|
+
parent_resource_id: String
|
|
44
|
+
).returns(WorkOS::Authorization::ParentResourceById)
|
|
45
|
+
end
|
|
46
|
+
def self.new(parent_resource_id:); end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class ParentResourceByExternalId
|
|
50
|
+
sig { returns(String) }
|
|
51
|
+
def parent_resource_type_slug; end
|
|
52
|
+
|
|
53
|
+
sig { returns(String) }
|
|
54
|
+
def parent_resource_external_id; end
|
|
55
|
+
|
|
56
|
+
sig do
|
|
57
|
+
params(
|
|
58
|
+
parent_resource_type_slug: String,
|
|
59
|
+
parent_resource_external_id: String
|
|
60
|
+
).returns(WorkOS::Authorization::ParentResourceByExternalId)
|
|
61
|
+
end
|
|
62
|
+
def self.new(parent_resource_type_slug:, parent_resource_external_id:); end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
class ParentById
|
|
66
|
+
sig { returns(String) }
|
|
67
|
+
def parent_resource_id; end
|
|
68
|
+
|
|
69
|
+
sig do
|
|
70
|
+
params(
|
|
71
|
+
parent_resource_id: String
|
|
72
|
+
).returns(WorkOS::Authorization::ParentById)
|
|
73
|
+
end
|
|
74
|
+
def self.new(parent_resource_id:); end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
class ParentByExternalId
|
|
78
|
+
sig { returns(String) }
|
|
79
|
+
def parent_resource_type_slug; end
|
|
80
|
+
|
|
81
|
+
sig { returns(String) }
|
|
82
|
+
def parent_external_id; end
|
|
83
|
+
|
|
84
|
+
sig do
|
|
85
|
+
params(
|
|
86
|
+
parent_resource_type_slug: String,
|
|
87
|
+
parent_external_id: String
|
|
88
|
+
).returns(WorkOS::Authorization::ParentByExternalId)
|
|
89
|
+
end
|
|
90
|
+
def self.new(parent_resource_type_slug:, parent_external_id:); end
|
|
91
|
+
end
|
|
92
|
+
|
|
9
93
|
sig { params(client: WorkOS::BaseClient).void }
|
|
10
94
|
def initialize(client); end
|
|
11
95
|
|
|
@@ -13,18 +97,17 @@ module WorkOS
|
|
|
13
97
|
params(
|
|
14
98
|
organization_membership_id: String,
|
|
15
99
|
permission_slug: String,
|
|
16
|
-
|
|
17
|
-
resource_external_id: T.nilable(String),
|
|
18
|
-
resource_type_slug: T.nilable(String),
|
|
100
|
+
resource_target: T.any(WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId),
|
|
19
101
|
request_options: T::Hash[Symbol, T.untyped]
|
|
20
102
|
).returns(WorkOS::AuthorizationCheck)
|
|
21
103
|
end
|
|
22
|
-
def check(organization_membership_id:, permission_slug:,
|
|
104
|
+
def check(organization_membership_id:, permission_slug:, resource_target:, request_options:); end
|
|
23
105
|
|
|
24
106
|
sig do
|
|
25
107
|
params(
|
|
26
108
|
organization_membership_id: String,
|
|
27
109
|
permission_slug: String,
|
|
110
|
+
parent_resource: T.any(WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId),
|
|
28
111
|
before: T.nilable(String),
|
|
29
112
|
after: T.nilable(String),
|
|
30
113
|
limit: T.nilable(Integer),
|
|
@@ -32,7 +115,7 @@ module WorkOS
|
|
|
32
115
|
request_options: T::Hash[Symbol, T.untyped]
|
|
33
116
|
).returns(WorkOS::Types::ListStruct)
|
|
34
117
|
end
|
|
35
|
-
def list_resources_for_membership(organization_membership_id:, permission_slug:, before:, after:, limit:, order:, request_options:); end
|
|
118
|
+
def list_resources_for_membership(organization_membership_id:, permission_slug:, parent_resource:, before:, after:, limit:, order:, request_options:); end
|
|
36
119
|
|
|
37
120
|
sig do
|
|
38
121
|
params(
|
|
@@ -77,25 +160,21 @@ module WorkOS
|
|
|
77
160
|
params(
|
|
78
161
|
organization_membership_id: String,
|
|
79
162
|
role_slug: String,
|
|
80
|
-
|
|
81
|
-
resource_external_id: T.nilable(String),
|
|
82
|
-
resource_type_slug: T.nilable(String),
|
|
163
|
+
resource_target: T.any(WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId),
|
|
83
164
|
request_options: T::Hash[Symbol, T.untyped]
|
|
84
165
|
).returns(WorkOS::RoleAssignment)
|
|
85
166
|
end
|
|
86
|
-
def assign_role(organization_membership_id:, role_slug:,
|
|
167
|
+
def assign_role(organization_membership_id:, role_slug:, resource_target:, request_options:); end
|
|
87
168
|
|
|
88
169
|
sig do
|
|
89
170
|
params(
|
|
90
171
|
organization_membership_id: String,
|
|
91
172
|
role_slug: String,
|
|
92
|
-
|
|
93
|
-
resource_external_id: T.nilable(String),
|
|
94
|
-
resource_type_slug: T.nilable(String),
|
|
173
|
+
resource_target: T.any(WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId),
|
|
95
174
|
request_options: T::Hash[Symbol, T.untyped]
|
|
96
175
|
).returns(NilClass)
|
|
97
176
|
end
|
|
98
|
-
def remove_role(organization_membership_id:, role_slug:,
|
|
177
|
+
def remove_role(organization_membership_id:, role_slug:, resource_target:, request_options:); end
|
|
99
178
|
|
|
100
179
|
sig do
|
|
101
180
|
params(
|
|
@@ -201,13 +280,11 @@ module WorkOS
|
|
|
201
280
|
external_id: String,
|
|
202
281
|
name: T.nilable(String),
|
|
203
282
|
description: T.nilable(String),
|
|
204
|
-
|
|
205
|
-
parent_resource_external_id: T.nilable(String),
|
|
206
|
-
parent_resource_type_slug: T.nilable(String),
|
|
283
|
+
parent_resource: T.nilable(T.any(WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId)),
|
|
207
284
|
request_options: T::Hash[Symbol, T.untyped]
|
|
208
285
|
).returns(WorkOS::AuthorizationResource)
|
|
209
286
|
end
|
|
210
|
-
def update_resource_by_external_id(organization_id:, resource_type_slug:, external_id:, name:, description:,
|
|
287
|
+
def update_resource_by_external_id(organization_id:, resource_type_slug:, external_id:, name:, description:, parent_resource:, request_options:); end
|
|
211
288
|
|
|
212
289
|
sig do
|
|
213
290
|
params(
|
|
@@ -246,10 +323,11 @@ module WorkOS
|
|
|
246
323
|
resource_type_slug: T.nilable(String),
|
|
247
324
|
resource_external_id: T.nilable(String),
|
|
248
325
|
search: T.nilable(String),
|
|
326
|
+
parent: T.nilable(T.any(WorkOS::Authorization::ParentById, WorkOS::Authorization::ParentByExternalId)),
|
|
249
327
|
request_options: T::Hash[Symbol, T.untyped]
|
|
250
328
|
).returns(WorkOS::Types::ListStruct)
|
|
251
329
|
end
|
|
252
|
-
def list_resources(before:, after:, limit:, order:, organization_id:, resource_type_slug:, resource_external_id:, search:, request_options:); end
|
|
330
|
+
def list_resources(before:, after:, limit:, order:, organization_id:, resource_type_slug:, resource_external_id:, search:, parent:, request_options:); end
|
|
253
331
|
|
|
254
332
|
sig do
|
|
255
333
|
params(
|
|
@@ -258,13 +336,11 @@ module WorkOS
|
|
|
258
336
|
resource_type_slug: String,
|
|
259
337
|
organization_id: String,
|
|
260
338
|
description: T.nilable(String),
|
|
261
|
-
|
|
262
|
-
parent_resource_external_id: T.nilable(String),
|
|
263
|
-
parent_resource_type_slug: T.nilable(String),
|
|
339
|
+
parent_resource: T.nilable(T.any(WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId)),
|
|
264
340
|
request_options: T::Hash[Symbol, T.untyped]
|
|
265
341
|
).returns(WorkOS::AuthorizationResource)
|
|
266
342
|
end
|
|
267
|
-
def create_resource(external_id:, name:, resource_type_slug:, organization_id:, description:,
|
|
343
|
+
def create_resource(external_id:, name:, resource_type_slug:, organization_id:, description:, parent_resource:, request_options:); end
|
|
268
344
|
|
|
269
345
|
sig do
|
|
270
346
|
params(
|
|
@@ -279,13 +355,11 @@ module WorkOS
|
|
|
279
355
|
resource_id: String,
|
|
280
356
|
name: T.nilable(String),
|
|
281
357
|
description: T.nilable(String),
|
|
282
|
-
|
|
283
|
-
parent_resource_external_id: T.nilable(String),
|
|
284
|
-
parent_resource_type_slug: T.nilable(String),
|
|
358
|
+
parent_resource: T.nilable(T.any(WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId)),
|
|
285
359
|
request_options: T::Hash[Symbol, T.untyped]
|
|
286
360
|
).returns(WorkOS::AuthorizationResource)
|
|
287
361
|
end
|
|
288
|
-
def update_resource(resource_id:, name:, description:,
|
|
362
|
+
def update_resource(resource_id:, name:, description:, parent_resource:, request_options:); end
|
|
289
363
|
|
|
290
364
|
sig do
|
|
291
365
|
params(
|