Skip to content
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

Mark preserve_existing_sessions optional #108

Merged
merged 2 commits into from
Dec 15, 2023
Merged
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
19 changes: 9 additions & 10 deletions lib/stytch/b2b_organizations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,6 @@ def initialize(connection)
# member_id::
# Globally unique UUID that identifies a specific Member. The `member_id` is critical to perform operations on a Member, so be sure to preserve this value.
# The type of this field is +String+.
# preserve_existing_sessions::
# (Coming Soon) Whether to preserve existing sessions when explicit Roles that are revoked are also implicitly assigned
# by SSO connection or SSO group. Defaults to `false` - that is, existing Member Sessions that contain SSO
# authentication factors with the affected SSO connection IDs will be revoked.
# The type of this field is +Boolean+.
# name::
# The name of the Member.
#
Expand Down Expand Up @@ -541,8 +536,13 @@ def initialize(connection)
# authentication factors with the affected connection ID. You can preserve these sessions by passing in the
# `preserve_existing_sessions` parameter with a value of `true`.
#
# If this field is provided, the logged-in Member must have permission to perform the `update.settings.roles` action on the `stytch.member` Resource.
# 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.roles` action on the `stytch.member` Resource.
# The type of this field is nilable list of +String+.
# preserve_existing_sessions::
# (Coming Soon) Whether to preserve existing sessions when explicit Roles that are revoked are also implicitly assigned
# by SSO connection or SSO group. Defaults to `false` - that is, existing Member Sessions that contain SSO
# authentication factors with the affected SSO connection IDs will be revoked.
# The type of this field is nilable +Boolean+.
#
# == Returns:
# An object with the following fields:
Expand All @@ -567,28 +567,27 @@ def initialize(connection)
def update(
organization_id:,
member_id:,
preserve_existing_sessions:,
name: nil,
trusted_metadata: nil,
untrusted_metadata: nil,
is_breakglass: nil,
mfa_phone_number: nil,
mfa_enrolled: nil,
roles: nil,
preserve_existing_sessions: nil,
method_options: nil
)
headers = {}
headers = headers.merge(method_options.to_headers) unless method_options.nil?
request = {
preserve_existing_sessions: preserve_existing_sessions
}
request = {}
request[:name] = name unless name.nil?
request[:trusted_metadata] = trusted_metadata unless trusted_metadata.nil?
request[:untrusted_metadata] = untrusted_metadata unless untrusted_metadata.nil?
request[:is_breakglass] = is_breakglass unless is_breakglass.nil?
request[:mfa_phone_number] = mfa_phone_number unless mfa_phone_number.nil?
request[:mfa_enrolled] = mfa_enrolled unless mfa_enrolled.nil?
request[:roles] = roles unless roles.nil?
request[:preserve_existing_sessions] = preserve_existing_sessions unless preserve_existing_sessions.nil?

put_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}", request, headers)
end
Expand Down
18 changes: 9 additions & 9 deletions lib/stytch/b2b_passwords.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ def strength_check(
# 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+.
# preserve_existing_sessions::
# (Coming Soon) Whether to preserve existing sessions when explicit Roles that are revoked are also implicitly assigned
# by SSO connection or SSO group. Defaults to `false` - that is, existing Member Sessions that contain SSO
# authentication factors with the affected SSO connection IDs will be revoked.
# The type of this field is +Boolean+.
# md_5_config::
# Optional parameters for MD-5 hash types.
# The type of this field is nilable +MD5Config+ (+object+).
Expand Down Expand Up @@ -143,6 +138,11 @@ def strength_check(
# authentication factors with the affected connection ID. You can preserve these sessions by passing in the
# `preserve_existing_sessions` parameter with a value of `true`.
# The type of this field is nilable list of +String+.
# preserve_existing_sessions::
# (Coming Soon) Whether to preserve existing sessions when explicit Roles that are revoked are also implicitly assigned
# by SSO connection or SSO group. Defaults to `false` - that is, existing Member Sessions that contain SSO
# authentication factors with the affected SSO connection IDs will be revoked.
# The type of this field is nilable +Boolean+.
#
# == Returns:
# An object with the following fields:
Expand All @@ -169,7 +169,6 @@ def migrate(
hash:,
hash_type:,
organization_id:,
preserve_existing_sessions:,
md_5_config: nil,
argon_2_config: nil,
sha_1_config: nil,
Expand All @@ -178,15 +177,15 @@ def migrate(
name: nil,
trusted_metadata: nil,
untrusted_metadata: nil,
roles: nil
roles: nil,
preserve_existing_sessions: nil
)
headers = {}
request = {
email_address: email_address,
hash: hash,
hash_type: hash_type,
organization_id: organization_id,
preserve_existing_sessions: preserve_existing_sessions
organization_id: organization_id
}
request[:md_5_config] = md_5_config unless md_5_config.nil?
request[:argon_2_config] = argon_2_config unless argon_2_config.nil?
Expand All @@ -197,6 +196,7 @@ def migrate(
request[:trusted_metadata] = trusted_metadata unless trusted_metadata.nil?
request[:untrusted_metadata] = untrusted_metadata unless untrusted_metadata.nil?
request[:roles] = roles unless roles.nil?
request[:preserve_existing_sessions] = preserve_existing_sessions unless preserve_existing_sessions.nil?

post_request('/v1/b2b/passwords/migrate', request, headers)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/stytch/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Stytch
VERSION = '7.0.0'
VERSION = '7.0.1'
end