Class: StytchB2B::Organizations

Inherits:
Object
  • Object
show all
Includes:
Stytch::RequestHelper
Defined in:
lib/stytch/b2b_organizations.rb

Defined Under Namespace

Classes: Members

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Stytch::RequestHelper

#delete_request, #get_request, #post_request, #put_request, #request_with_query_params

Constructor Details

#initialize(connection) ⇒ Organizations

Returns a new instance of Organizations.



54
55
56
57
58
# File 'lib/stytch/b2b_organizations.rb', line 54

def initialize(connection)
  @connection = connection

  @members = StytchB2B::Organizations::Members.new(@connection)
end

Instance Attribute Details

#membersObject (readonly)

Returns the value of attribute members.



52
53
54
# File 'lib/stytch/b2b_organizations.rb', line 52

def members
  @members
end

Instance Method Details

#create(organization_name:, organization_slug: nil, organization_logo_url: nil, trusted_metadata: nil, sso_jit_provisioning: nil, email_allowed_domains: nil, email_jit_provisioning: nil, email_invites: nil, auth_methods: nil, allowed_auth_methods: nil, mfa_policy: nil, rbac_email_implicit_role_assignments: nil, mfa_methods: nil, allowed_mfa_methods: nil) ⇒ Object

Creates an Organization. An ‘organization_name` and a unique `organization_slug` are required.

By default, ‘email_invites` and `sso_jit_provisioning` will be set to `ALL_ALLOWED`, and `mfa_policy` will be set to `OPTIONAL` if no Organization authentication settings are explicitly defined in the request.

*See the [Organization authentication settings](stytch.com/docs/b2b/api/org-auth-settings) resource to learn more about fields like ‘email_jit_provisioning`, `email_invites`, `sso_jit_provisioning`, etc., and their behaviors.

Parameters:

organization_name

The name of the Organization. Must be between 1 and 128 characters in length. The type of this field is String.

organization_slug

The unique URL slug of the Organization. The slug only accepts alphanumeric characters and the following reserved characters: ‘-` `.` `_` `~`. Must be between 2 and 128 characters in length. The type of this field is nilable String.

organization_logo_url

The image URL of the Organization logo. The type of this field is nilable String.

trusted_metadata

An arbitrary JSON object for storing application-specific data or identity-provider-specific data. The type of this field is nilable object.

sso_jit_provisioning

The authentication setting that controls the JIT provisioning of Members when authenticating via SSO. The accepted values are:

‘ALL_ALLOWED` – new Members will be automatically provisioned upon successful authentication via any of the Organization’s ‘sso_active_connections`.

‘RESTRICTED` – only new Members with SSO logins that comply with `sso_jit_provisioning_allowed_connections` can be provisioned upon authentication.

‘NOT_ALLOWED` – disable JIT provisioning via SSO.

The type of this field is nilable String.

email_allowed_domains

An array of email domains that allow invites or JIT provisioning for new Members. This list is enforced when either ‘email_invites` or `email_jit_provisioning` is set to `RESTRICTED`.

Common domains such as `gmail.com` are not allowed. See the [common email domains resource](https://stytch.com/docs/b2b/api/common-email-domains) for the full list.

The type of this field is nilable list of String.

email_jit_provisioning

The authentication setting that controls how a new Member can be provisioned by authenticating via Email Magic Link or OAuth. The accepted values are:

‘RESTRICTED` – only new Members with verified emails that comply with `email_allowed_domains` can be provisioned upon authentication via Email Magic Link or OAuth.

‘NOT_ALLOWED` – disable JIT provisioning via Email Magic Link and OAuth.

The type of this field is nilable String.

email_invites

The authentication setting that controls how a new Member can be invited to an organization by email. The accepted values are:

‘ALL_ALLOWED` – any new Member can be invited to join via email.

‘RESTRICTED` – only new Members with verified emails that comply with `email_allowed_domains` can be invited via email.

‘NOT_ALLOWED` – disable email invites.

The type of this field is nilable String.

auth_methods

The setting that controls which authentication methods can be used by Members of an Organization. The accepted values are:

‘ALL_ALLOWED` – the default setting which allows all authentication methods to be used.

‘RESTRICTED` – only methods that comply with `allowed_auth_methods` can be used for authentication. This setting does not apply to Members with `is_breakglass` set to `true`.

The type of this field is nilable String.

allowed_auth_methods

An array of allowed authentication methods. This list is enforced when ‘auth_methods` is set to `RESTRICTED`. The list’s accepted values are: ‘sso`, `magic_link`, `password`, `google_oauth`, and `microsoft_oauth`.

The type of this field is nilable list of String.

mfa_policy

The setting that controls the MFA policy for all Members in the Organization. The accepted values are:

‘REQUIRED_FOR_ALL` – All Members within the Organization will be required to complete MFA every time they wish to log in. However, any active Session that existed prior to this setting change will remain valid.

‘OPTIONAL` – The default value. The Organization does not require MFA by default for all Members. Members will be required to complete MFA only if their `mfa_enrolled` status is set to true.

The type of this field is nilable String.

rbac_email_implicit_role_assignments

Implicit role assignments based off of email domains. For each domain-Role pair, all Members whose email addresses have the specified email domain will be granted the associated Role, regardless of their login method. See the [RBAC guide](stytch.com/docs/b2b/guides/rbac/role-assignment) for more information about role assignment. The type of this field is nilable list of EmailImplicitRoleAssignment (object).

mfa_methods

The setting that controls which MFA methods can be used by Members of an Organization. The accepted values are:

‘ALL_ALLOWED` – the default setting which allows all authentication methods to be used.

‘RESTRICTED` – only methods that comply with `allowed_mfa_methods` can be used for authentication. This setting does not apply to Members with `is_breakglass` set to `true`.

The type of this field is nilable String.

allowed_mfa_methods

An array of allowed MFA authentication methods. This list is enforced when ‘mfa_methods` is set to `RESTRICTED`. The list’s accepted values are: ‘sms_otp` and `totp`.

The type of this field is nilable list of String.

Returns:

An object with the following fields:

request_id

Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is String.

organization

The [Organization object](stytch.com/docs/b2b/api/organization-object). The type of this field is Organization (object).

status_code

The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is Integer.



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/stytch/b2b_organizations.rb', line 165

def create(
  organization_name:,
  organization_slug: nil,
  organization_logo_url: nil,
  trusted_metadata: nil,
  sso_jit_provisioning: nil,
  email_allowed_domains: nil,
  email_jit_provisioning: nil,
  email_invites: nil,
  auth_methods: nil,
  allowed_auth_methods: nil,
  mfa_policy: nil,
  rbac_email_implicit_role_assignments: nil,
  mfa_methods: nil,
  allowed_mfa_methods: nil
)
  headers = {}
  request = {
    organization_name: organization_name
  }
  request[:organization_slug] = organization_slug unless organization_slug.nil?
  request[:organization_logo_url] = organization_logo_url unless organization_logo_url.nil?
  request[:trusted_metadata] =  unless .nil?
  request[:sso_jit_provisioning] = sso_jit_provisioning unless sso_jit_provisioning.nil?
  request[:email_allowed_domains] = email_allowed_domains unless email_allowed_domains.nil?
  request[:email_jit_provisioning] = email_jit_provisioning unless email_jit_provisioning.nil?
  request[:email_invites] = email_invites unless email_invites.nil?
  request[:auth_methods] = auth_methods unless auth_methods.nil?
  request[:allowed_auth_methods] = allowed_auth_methods unless allowed_auth_methods.nil?
  request[:mfa_policy] = mfa_policy unless mfa_policy.nil?
  request[:rbac_email_implicit_role_assignments] = rbac_email_implicit_role_assignments unless rbac_email_implicit_role_assignments.nil?
  request[:mfa_methods] = mfa_methods unless mfa_methods.nil?
  request[:allowed_mfa_methods] = allowed_mfa_methods unless allowed_mfa_methods.nil?

  post_request('/v1/b2b/organizations', request, headers)
end

#delete(organization_id:, method_options: nil) ⇒ Object

Deletes an Organization specified by ‘organization_id`. All Members of the Organization will also be deleted. /%}

Parameters:

organization_id

Globally unique UUID that identifies a specific Organization. The ‘organization_id` is critical to perform operations on an Organization, so be sure to preserve this value. The type of this field is String.

Returns:

An object with the following fields:

request_id

Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is String.

organization_id

Globally unique UUID that identifies a specific Organization. The ‘organization_id` is critical to perform operations on an Organization, so be sure to preserve this value. The type of this field is String.

status_code

The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is Integer.

Method Options:

This method supports an optional DeleteRequestOptions object which will modify the headers sent in the HTTP request.



453
454
455
456
457
458
459
460
# File 'lib/stytch/b2b_organizations.rb', line 453

def delete(
  organization_id:,
  method_options: nil
)
  headers = {}
  headers = headers.merge(method_options.to_headers) unless method_options.nil?
  delete_request("/v1/b2b/organizations/#{organization_id}", headers)
end

#get(organization_id:) ⇒ Object

Returns an Organization specified by ‘organization_id`.

Parameters:

organization_id

Globally unique UUID that identifies a specific Organization. The ‘organization_id` is critical to perform operations on an Organization, so be sure to preserve this value. The type of this field is String.

Returns:

An object with the following fields:

request_id

Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is String.

organization

The [Organization object](stytch.com/docs/b2b/api/organization-object). The type of this field is Organization (object).

status_code

The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is Integer.



220
221
222
223
224
225
226
227
# File 'lib/stytch/b2b_organizations.rb', line 220

def get(
  organization_id:
)
  headers = {}
  query_params = {}
  request = request_with_query_params("/v1/b2b/organizations/#{organization_id}", query_params)
  get_request(request, headers)
end

#metrics(organization_id:) ⇒ Object



503
504
505
506
507
508
509
510
# File 'lib/stytch/b2b_organizations.rb', line 503

def metrics(
  organization_id:
)
  headers = {}
  query_params = {}
  request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/metrics", query_params)
  get_request(request, headers)
end

#search(cursor: nil, limit: nil, query: nil) ⇒ Object

Search for Organizations. If you send a request with no body params, no filtering will be applied and the endpoint will return all Organizations. All fuzzy search filters require a minimum of three characters.

Parameters:

cursor

The ‘cursor` field allows you to paginate through your results. Each result array is limited to 1000 results. If your query returns more than 1000 results, you will need to paginate the responses using the `cursor`. If you receive a response that includes a non-null `next_cursor` in the `results_metadata` object, repeat the search call with the `next_cursor` value set to the `cursor` field to retrieve the next page of results. Continue to make search calls until the `next_cursor` in the response is null. The type of this field is nilable String.

limit

The number of search results to return per page. The default limit is 100. A maximum of 1000 results can be returned by a single search request. If the total size of your result set is greater than one page size, you must paginate the response. See the ‘cursor` field. The type of this field is nilable Integer.

query

The optional query object contains the operator, i.e. ‘AND` or `OR`, and the operands that will filter your results. Only an operator is required. If you include no operands, no filtering will be applied. If you include no query object, it will return all Organizations with no filtering applied. The type of this field is nilable SearchQuery (object).

Returns:

An object with the following fields:

request_id

Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is String.

organizations

An array of [Organization objects](stytch.com/docs/b2b/api/organization-object). The type of this field is list of Organization (object).

results_metadata

The search ‘results_metadata` object contains metadata relevant to your specific query like `total` and `next_cursor`. The type of this field is ResultsMetadata (object).

status_code

The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is Integer.



489
490
491
492
493
494
495
496
497
498
499
500
501
# File 'lib/stytch/b2b_organizations.rb', line 489

def search(
  cursor: nil,
  limit: nil,
  query: nil
)
  headers = {}
  request = {}
  request[:cursor] = cursor unless cursor.nil?
  request[:limit] = limit unless limit.nil?
  request[:query] = query unless query.nil?

  post_request('/v1/b2b/organizations/search', request, headers)
end

#update(organization_id:, organization_name: nil, organization_slug: nil, organization_logo_url: nil, trusted_metadata: nil, sso_default_connection_id: nil, sso_jit_provisioning: nil, sso_jit_provisioning_allowed_connections: nil, email_allowed_domains: nil, email_jit_provisioning: nil, email_invites: nil, auth_methods: nil, allowed_auth_methods: nil, mfa_policy: nil, rbac_email_implicit_role_assignments: nil, mfa_methods: nil, allowed_mfa_methods: nil, method_options: nil) ⇒ Object

Updates an Organization specified by ‘organization_id`. An Organization must always have at least one auth setting set to either `RESTRICTED` or `ALL_ALLOWED` in order to provision new Members.

*See the [Organization authentication settings](stytch.com/docs/b2b/api/org-auth-settings) resource to learn more about fields like ‘email_jit_provisioning`, `email_invites`, `sso_jit_provisioning`, etc., and their behaviors.

Our RBAC implementation offers out-of-the-box handling of authorization checks for this endpoint. If you pass in a header containing a ‘session_token` or a `session_jwt` for an unexpired Member Session, we will check that the Member Session has the necessary permissions. The specific permissions needed depend on which of the optional fields are passed in the request. For example, if the `organization_name` argument is provided, the Member Session must have permission to perform the `update.info.name` action on the `stytch.organization` Resource.

If the Member Session does not contain a Role that satisfies the requested permissions, or if the Member’s Organization does not match the ‘organization_id` passed in the request, a 403 error will be thrown. Otherwise, the request will proceed as normal.

To learn more about our RBAC implementation, see our [RBAC guide](stytch.com/docs/b2b/guides/rbac/overview).

Parameters:

organization_id

Globally unique UUID that identifies a specific Organization. The ‘organization_id` is critical to perform operations on an Organization, so be sure to preserve this value. The type of this field is String.

organization_name

The name of the Organization. Must be between 1 and 128 characters in length.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.info.name` action on the `stytch.organization` Resource.

The type of this field is nilable +String+.
organization_slug

The unique URL slug of the Organization. The slug only accepts alphanumeric characters and the following reserved characters: ‘-` `.` `_` `~`. Must be between 2 and 128 characters in length.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.info.slug` action on the `stytch.organization` Resource.

The type of this field is nilable +String+.
organization_logo_url

The image URL of the Organization logo.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.info.logo-url` action on the `stytch.organization` Resource.

The type of this field is nilable +String+.
trusted_metadata

An arbitrary JSON object for storing application-specific data or identity-provider-specific data.

If a session header is passed into the request, this field may **not** be passed into the request. You cannot
update trusted metadata when acting as a Member.

The type of this field is nilable object.

sso_default_connection_id

The default connection used for SSO when there are multiple active connections.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.settings.default-sso-connection` action on the `stytch.organization` Resource.

The type of this field is nilable +String+.
sso_jit_provisioning

The authentication setting that controls the JIT provisioning of Members when authenticating via SSO. The accepted values are:

‘ALL_ALLOWED` – new Members will be automatically provisioned upon successful authentication via any of the Organization’s ‘sso_active_connections`.

‘RESTRICTED` – only new Members with SSO logins that comply with `sso_jit_provisioning_allowed_connections` can be provisioned upon authentication.

‘NOT_ALLOWED` – disable JIT provisioning via SSO.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.settings.sso-jit-provisioning` action on the `stytch.organization` Resource.

The type of this field is nilable +String+.
sso_jit_provisioning_allowed_connections

An array of ‘connection_id`s that reference [SAML Connection objects](stytch.com/docs/b2b/api/saml-connection-object). Only these connections will be allowed to JIT provision Members via SSO when `sso_jit_provisioning` is set to `RESTRICTED`.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.settings.sso-jit-provisioning` action on the `stytch.organization` Resource.

The type of this field is nilable list of +String+.
email_allowed_domains

An array of email domains that allow invites or JIT provisioning for new Members. This list is enforced when either ‘email_invites` or `email_jit_provisioning` is set to `RESTRICTED`.

Common domains such as `gmail.com` are not allowed. See the [common email domains resource](https://stytch.com/docs/b2b/api/common-email-domains) for the full list.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.settings.allowed-domains` action on the `stytch.organization` Resource.

The type of this field is nilable list of +String+.
email_jit_provisioning

The authentication setting that controls how a new Member can be provisioned by authenticating via Email Magic Link or OAuth. The accepted values are:

‘RESTRICTED` – only new Members with verified emails that comply with `email_allowed_domains` can be provisioned upon authentication via Email Magic Link or OAuth.

‘NOT_ALLOWED` – disable JIT provisioning via Email Magic Link and OAuth.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.settings.email-jit-provisioning` action on the `stytch.organization` Resource.

The type of this field is nilable +String+.
email_invites

The authentication setting that controls how a new Member can be invited to an organization by email. The accepted values are:

‘ALL_ALLOWED` – any new Member can be invited to join via email.

‘RESTRICTED` – only new Members with verified emails that comply with `email_allowed_domains` can be invited via email.

‘NOT_ALLOWED` – disable email invites.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.settings.email-invites` action on the `stytch.organization` Resource.

The type of this field is nilable +String+.
auth_methods

The setting that controls which authentication methods can be used by Members of an Organization. The accepted values are:

‘ALL_ALLOWED` – the default setting which allows all authentication methods to be used.

‘RESTRICTED` – only methods that comply with `allowed_auth_methods` can be used for authentication. This setting does not apply to Members with `is_breakglass` set to `true`.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.settings.allowed-auth-methods` action on the `stytch.organization` Resource.

The type of this field is nilable +String+.
allowed_auth_methods

An array of allowed authentication methods. This list is enforced when ‘auth_methods` is set to `RESTRICTED`. The list’s accepted values are: ‘sso`, `magic_link`, `password`, `google_oauth`, and `microsoft_oauth`.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.settings.allowed-auth-methods` action on the `stytch.organization` Resource.

The type of this field is nilable list of +String+.
mfa_policy

The setting that controls the MFA policy for all Members in the Organization. The accepted values are:

‘REQUIRED_FOR_ALL` – All Members within the Organization will be required to complete MFA every time they wish to log in. However, any active Session that existed prior to this setting change will remain valid.

‘OPTIONAL` – The default value. The Organization does not require MFA by default for all Members. Members will be required to complete MFA only if their `mfa_enrolled` status is set to true.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.settings.mfa-policy` action on the `stytch.organization` Resource.

The type of this field is nilable +String+.
rbac_email_implicit_role_assignments

Implicit role assignments based off of email domains. For each domain-Role pair, all Members whose email addresses have the specified email domain will be granted the associated Role, regardless of their login method. See the [RBAC guide](stytch.com/docs/b2b/guides/rbac/role-assignment) for more information about role assignment.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.settings.implicit-roles` action on the `stytch.organization` Resource.

The type of this field is nilable list of +EmailImplicitRoleAssignment+.
mfa_methods

The setting that controls which MFA methods can be used by Members of an Organization. The accepted values are:

‘ALL_ALLOWED` – the default setting which allows all authentication methods to be used.

‘RESTRICTED` – only methods that comply with `allowed_mfa_methods` can be used for authentication. This setting does not apply to Members with `is_breakglass` set to `true`.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.settings.allowed-mfa-methods` action on the `stytch.organization` Resource.

The type of this field is nilable +String+.
allowed_mfa_methods

An array of allowed MFA authentication methods. This list is enforced when ‘mfa_methods` is set to `RESTRICTED`. The list’s accepted values are: ‘sms_otp` and `totp`.

If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the ‘update.settings.allowed-mfa-methods` action on the `stytch.organization` Resource.

The type of this field is nilable list of +String+.

Returns:

An object with the following fields:

request_id

Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is String.

organization

The [Organization object](stytch.com/docs/b2b/api/organization-object). The type of this field is Organization (object).

status_code

The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is Integer.

Method Options:

This method supports an optional UpdateRequestOptions object which will modify the headers sent in the HTTP request.



389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/stytch/b2b_organizations.rb', line 389

def update(
  organization_id:,
  organization_name: nil,
  organization_slug: nil,
  organization_logo_url: nil,
  trusted_metadata: nil,
  sso_default_connection_id: nil,
  sso_jit_provisioning: nil,
  sso_jit_provisioning_allowed_connections: nil,
  email_allowed_domains: nil,
  email_jit_provisioning: nil,
  email_invites: nil,
  auth_methods: nil,
  allowed_auth_methods: nil,
  mfa_policy: nil,
  rbac_email_implicit_role_assignments: nil,
  mfa_methods: nil,
  allowed_mfa_methods: nil,
  method_options: nil
)
  headers = {}
  headers = headers.merge(method_options.to_headers) unless method_options.nil?
  request = {}
  request[:organization_name] = organization_name unless organization_name.nil?
  request[:organization_slug] = organization_slug unless organization_slug.nil?
  request[:organization_logo_url] = organization_logo_url unless organization_logo_url.nil?
  request[:trusted_metadata] =  unless .nil?
  request[:sso_default_connection_id] = sso_default_connection_id unless sso_default_connection_id.nil?
  request[:sso_jit_provisioning] = sso_jit_provisioning unless sso_jit_provisioning.nil?
  request[:sso_jit_provisioning_allowed_connections] = sso_jit_provisioning_allowed_connections unless sso_jit_provisioning_allowed_connections.nil?
  request[:email_allowed_domains] = email_allowed_domains unless email_allowed_domains.nil?
  request[:email_jit_provisioning] = email_jit_provisioning unless email_jit_provisioning.nil?
  request[:email_invites] = email_invites unless email_invites.nil?
  request[:auth_methods] = auth_methods unless auth_methods.nil?
  request[:allowed_auth_methods] = allowed_auth_methods unless allowed_auth_methods.nil?
  request[:mfa_policy] = mfa_policy unless mfa_policy.nil?
  request[:rbac_email_implicit_role_assignments] = rbac_email_implicit_role_assignments unless rbac_email_implicit_role_assignments.nil?
  request[:mfa_methods] = mfa_methods unless mfa_methods.nil?
  request[:allowed_mfa_methods] = allowed_mfa_methods unless allowed_mfa_methods.nil?

  put_request("/v1/b2b/organizations/#{organization_id}", request, headers)
end