Module: Descope::Api::V1::Management::User
- Includes:
- Common
- Included in:
- Descope::Api::V1::Management
- Defined in:
- lib/descope/api/v1/management/user.rb
Overview
Management API calls
Constant Summary
Constants included from Common
Common::ACCESS_KEYS_SEARCH_PATH, Common::ACCESS_KEY_ACTIVATE_PATH, Common::ACCESS_KEY_CREATE_PATH, Common::ACCESS_KEY_DEACTIVATE_PATH, Common::ACCESS_KEY_DELETE_PATH, Common::ACCESS_KEY_LOAD_PATH, Common::ACCESS_KEY_UPDATE_PATH, Common::AUDIT_CREATE_EVENT, Common::AUDIT_SEARCH, Common::AUTHZ_NS_DELETE, Common::AUTHZ_NS_SAVE, Common::AUTHZ_RD_DELETE, Common::AUTHZ_RD_SAVE, Common::AUTHZ_RE_CREATE, Common::AUTHZ_RE_DELETE, Common::AUTHZ_RE_DELETE_RESOURCES, Common::AUTHZ_RE_HAS_RELATIONS, Common::AUTHZ_RE_RESOURCE, Common::AUTHZ_RE_TARGETS, Common::AUTHZ_RE_TARGET_ALL, Common::AUTHZ_RE_WHO, Common::AUTHZ_SCHEMA_DELETE, Common::AUTHZ_SCHEMA_LOAD, Common::AUTHZ_SCHEMA_SAVE, Common::FLOW_EXPORT_PATH, Common::FLOW_IMPORT_PATH, Common::FLOW_LIST_PATH, Common::GROUP_LOAD_ALL_FOR_MEMBER_PATH, Common::GROUP_LOAD_ALL_GROUP_MEMBERS_PATH, Common::GROUP_LOAD_ALL_PATH, Common::PASSWORD_SETTINGS_PATH, Common::PERMISSION_CREATE_PATH, Common::PERMISSION_DELETE_PATH, Common::PERMISSION_LOAD_ALL_PATH, Common::PERMISSION_UPDATE_PATH, Common::PROJECT_CLONE, Common::PROJECT_DELETE_PATH, Common::PROJECT_EXPORT_PATH, Common::PROJECT_IMPORT_PATH, Common::PROJECT_UPDATE_NAME, Common::ROLE_CREATE_PATH, Common::ROLE_DELETE_PATH, Common::ROLE_LOAD_ALL_PATH, Common::ROLE_SEARCH_PATH, Common::ROLE_UPDATE_PATH, Common::SCIM_GROUPS_PATH, Common::SCIM_RESOURCE_TYPES_PATH, Common::SCIM_SERVICE_PROVIDER_CONFIG_PATH, Common::SCIM_USERS_PATH, Common::SSO_APPLICATION_DELETE_PATH, Common::SSO_APPLICATION_LOAD_ALL_PATH, Common::SSO_APPLICATION_LOAD_PATH, Common::SSO_APPLICATION_OIDC_CREATE_PATH, Common::SSO_APPLICATION_OIDC_UPDATE_PATH, Common::SSO_APPLICATION_SAML_CREATE_PATH, Common::SSO_APPLICATION_SAML_UPDATE_PATH, Common::SSO_CONFIGURE_OIDC_SETTINGS_PATH, Common::SSO_CONFIGURE_SAML_METADATA_PATH, Common::SSO_CONFIGURE_SAML_SETTINGS_PATH, Common::SSO_LOAD_SETTINGS_PATH, Common::SSO_MAPPING_PATH, Common::SSO_METADATA_PATH, Common::SSO_OIDC_PATH, Common::SSO_SETTINGS_PATH, Common::TENANT_CREATE_PATH, Common::TENANT_DELETE_PATH, Common::TENANT_LOAD_ALL_PATH, Common::TENANT_LOAD_PATH, Common::TENANT_SEARCH_ALL_PATH, Common::TENANT_UPDATE_PATH, Common::TEST_USERS_SEARCH_PATH, Common::TEST_USER_CREATE_PATH, Common::THEME_EXPORT_PATH, Common::THEME_IMPORT_PATH, Common::UPDATE_JWT_PATH, Common::USERS_SEARCH_PATH, Common::USER_ADD_ROLE_PATH, Common::USER_ADD_TENANT_PATH, Common::USER_CREATE_BATCH_PATH, Common::USER_CREATE_PATH, Common::USER_DELETE_ALL_TEST_USERS_PATH, Common::USER_DELETE_PATH, Common::USER_EXPIRE_PASSWORD_PATH, Common::USER_GENERATE_EMBEDDED_LINK_PATH, Common::USER_GENERATE_ENCHANTED_LINK_FOR_TEST_PATH, Common::USER_GENERATE_MAGIC_LINK_FOR_TEST_PATH, Common::USER_GENERATE_OTP_FOR_TEST_PATH, Common::USER_GET_PROVIDER_TOKEN, Common::USER_LOAD_PATH, Common::USER_LOGOUT_PATH, Common::USER_PATCH_PATH, Common::USER_REMOVE_ROLE_PATH, Common::USER_REMOVE_TENANT_PATH, Common::USER_SEARCH_PATH, Common::USER_SET_ACTIVE_PASSWORD_PATH, Common::USER_SET_PASSWORD_PATH, Common::USER_SET_TEMPORARY_PASSWORD_PATH, Common::USER_UPDATE_CUSTOM_ATTRIBUTE_PATH, Common::USER_UPDATE_EMAIL_PATH, Common::USER_UPDATE_LOGIN_ID_PATH, Common::USER_UPDATE_NAME_PATH, Common::USER_UPDATE_PATH, Common::USER_UPDATE_PHONE_PATH, Common::USER_UPDATE_PICTURE_PATH, Common::USER_UPDATE_STATUS_PATH
Instance Method Summary collapse
-
#activate(login_id) ⇒ Object
Updates an existing user’s status, using a valid management key.
- #add_tenant_role(login_id: nil, tenant_id: nil, role_names: []) ⇒ Object
-
#create_batch_users(users = []) ⇒ Object
Batch Create Users, using a valid management key.
-
#create_test_user(**args) ⇒ Object
Create a new test user.
-
#create_user(**args) ⇒ Object
Create a new user, using a valid management key.
- #deactivate(login_id) ⇒ Object
- #delete_all_test_users ⇒ Object
-
#delete_user(login_id = nil) ⇒ Object
Delete a user, using a valid management key.
- #expire_password(login_id) ⇒ Object
- #generate_embedded_link(login_id: nil, custom_claims: nil) ⇒ Object
- #generate_enchanted_link_for_test_user(login_id: nil, uri: nil) ⇒ Object
- #generate_magic_link_for_test_user(method: nil, login_id: nil, uri: nil) ⇒ Object
- #generate_otp_for_test_user(method: nil, login_id: nil) ⇒ Object
-
#get_provider_token(login_id: nil, provider: nil) ⇒ Object
Get an existing user’s provider token, using a valid management key.
-
#invite_user(**args) ⇒ Object
Create a new user and invite them via an email message.
-
#load_by_user_id(user_id) ⇒ Object
Load a user’s data, using a valid management key by user id.
-
#load_user(login_id) ⇒ Object
Load a user’s data, using a valid management key.
-
#logout_user(login_id) ⇒ Object
Log a user out of all sessions, using a valid management key.
- #logout_user_by_id(user_id) ⇒ Object
- #map_to_values_object(input_map) ⇒ Object
- #patch_user(login_id: nil, email: nil, phone: nil, name: nil, given_name: nil, middle_name: nil, family_name: nil, role_names: [], user_tenants: [], picture: nil, custom_attributes: nil, verified_email: nil, verified_phone: nil, additional_identifiers: [], password: nil, hashed_password: {}, sso_app_ids: []) ⇒ Object
-
#search_all_test_users(tenant_ids: [], role_names: [], limit: 0, page: 0, custom_attributes: {}, statuses: [], emails: [], phones: [], sso_app_ids: [], sort: [], text: nil, login_ids: [], tenant_role_ids: {}, tenant_role_names: {}) ⇒ Hash
Search for all test users.
-
#search_all_users(login_id: nil, tenant_ids: [], role_names: [], text: nil, limit: 0, page: 0, sso_only: false, test_users_only: false, with_test_user: false, custom_attributes: {}, statuses: [], emails: [], phones: [], sso_app_ids: [], tenant_role_ids: {}, tenant_role_names: {}) ⇒ Object
Search for users, using a valid management key.
- #set_active_password(login_id: nil, password: nil) ⇒ Object
-
#set_password(login_id: nil, password: nil) ⇒ Object
Deprecated (use set_temporary_password(..) instead).
- #set_temporary_password(login_id: nil, password: nil) ⇒ Object
-
#update_custom_attribute(login_id: nil, attribute_key: nil, attribute_value: nil) ⇒ Object
Update an existing user’s custom attributes, using a valid management key.
-
#update_display_name(login_id: nil, name: nil, given_name: nil, middle_name: nil, family_name: nil) ⇒ Object
Updates an existing user’s display name, using a valid management key.
-
#update_email(login_id: nil, email: nil, verified: true) ⇒ Object
Updates an existing user’s email, using a valid management key.
- #update_jwt(jwt: nil, custom_claims: nil) ⇒ Object
-
#update_login_id(login_id: nil, new_login_id: nil) ⇒ Object
Updates an existing user’s login ID, using a valid management key.
-
#update_phone(login_id: nil, phone: nil, verified: true) ⇒ Object
Updates an existing user’s phone number, using a valid management key.
-
#update_picture(login_id: nil, picture: nil) ⇒ Object
Update an existing user’s profile picture, using a valid management key.
-
#update_user(login_id: nil, email: nil, phone: nil, name: nil, given_name: nil, middle_name: nil, family_name: nil, role_names: [], user_tenants: [], picture: nil, custom_attributes: nil, verified_email: nil, verified_phone: nil, additional_identifiers: [], password: nil, hashed_password: {}, sso_app_ids: []) ⇒ Object
Updates a user’s details, using a valid management key.
- #user_add_roles(login_id: nil, tenant_id: nil, role_names: []) ⇒ Object
- #user_add_tenant(login_id: nil, tenant_id: nil) ⇒ Object
- #user_remove_roles(login_id: nil, tenant_id: nil, role_names: []) ⇒ Object
- #user_remove_tenant(login_id: nil, tenant_id: nil) ⇒ Object
- #user_remove_tenant_roles(login_id: nil, tenant_id: nil, role_names: []) ⇒ Object
Methods included from Common
#associated_tenants_to_hash_array
Instance Method Details
#activate(login_id) ⇒ Object
Updates an existing user’s status, using a valid management key.
242 243 244 245 246 247 248 249 250 |
# File 'lib/descope/api/v1/management/user.rb', line 242 def activate(login_id) validate_login_id(login_id) path = Common::USER_UPDATE_STATUS_PATH request_params = { loginId: login_id, status: 'enabled' } post(path, request_params) end |
#add_tenant_role(login_id: nil, tenant_id: nil, role_names: []) ⇒ Object
426 427 428 429 430 431 432 433 |
# File 'lib/descope/api/v1/management/user.rb', line 426 def add_tenant_role(login_id: nil, tenant_id: nil, role_names: []) body = { loginId: login_id, tenantId: tenant_id, roleNames: role_names } post(Common::USER_ADD_TENANT_PATH, body) end |
#create_batch_users(users = []) ⇒ Object
Batch Create Users, using a valid management key.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/descope/api/v1/management/user.rb', line 21 def create_batch_users(users = []) users_params = [] users.each do |user| users_params.append(user_create(**user.merge(skip_create: true))) end path = Common::USER_CREATE_BATCH_PATH request_params = { users: users_params } post(path, request_params) end |
#create_test_user(**args) ⇒ Object
Create a new test user. The login_id is required and will determine what the user will use to sign in. Make sure the login id is unique for test. All other fields are optional. Test User Management:
-
Create test Users
-
Generate OTP (sms/email) for test users
-
Generate Magic Link (sms/email) for test users
-
Generate Enchanted Link (email) for test users
-
Delete Test Users
43 44 45 46 |
# File 'lib/descope/api/v1/management/user.rb', line 43 def create_test_user(**args) args[:test] = true user_create(**args) end |
#create_user(**args) ⇒ Object
Create a new user, using a valid management key. Once the user is created, the user can then login utilizing any sign-in api supported. This will then switch the user from invited to active.
14 15 16 17 |
# File 'lib/descope/api/v1/management/user.rb', line 14 def create_user(**args) @logger.debug("Creating user with args: #{args}") user_create(**args) end |
#deactivate(login_id) ⇒ Object
252 253 254 255 256 257 258 259 260 |
# File 'lib/descope/api/v1/management/user.rb', line 252 def deactivate(login_id) validate_login_id(login_id) path = Common::USER_UPDATE_STATUS_PATH request_params = { loginId: login_id, status: 'disabled' } post(path, request_params) end |
#delete_all_test_users ⇒ Object
119 120 121 122 |
# File 'lib/descope/api/v1/management/user.rb', line 119 def delete_all_test_users path = Common::USER_DELETE_ALL_TEST_USERS_PATH delete(path) end |
#delete_user(login_id = nil) ⇒ Object
Delete a user, using a valid management key.
110 111 112 113 114 115 116 117 |
# File 'lib/descope/api/v1/management/user.rb', line 110 def delete_user(login_id = nil) validate_login_id(login_id) path = Common::USER_DELETE_PATH request_params = { loginId: login_id } post(path, request_params) end |
#expire_password(login_id) ⇒ Object
469 470 471 472 473 474 475 |
# File 'lib/descope/api/v1/management/user.rb', line 469 def expire_password(login_id) validate_login_id(login_id) body = { loginId: login_id } post(Common::USER_EXPIRE_PASSWORD_PATH, body) end |
#generate_embedded_link(login_id: nil, custom_claims: nil) ⇒ Object
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 |
# File 'lib/descope/api/v1/management/user.rb', line 502 def (login_id: nil, custom_claims: nil) custom_claims ||= {} unless custom_claims.is_a?(Hash) raise Descope::ArgumentException.new( 'Unable to read custom_claims, not a Hash', code: 400 ) end validate_login_id(login_id) request_params = { loginId: login_id, customClaims: custom_claims.to_h } post(USER_GENERATE_EMBEDDED_LINK_PATH, request_params) end |
#generate_enchanted_link_for_test_user(login_id: nil, uri: nil) ⇒ Object
494 495 496 497 498 499 500 |
# File 'lib/descope/api/v1/management/user.rb', line 494 def generate_enchanted_link_for_test_user(login_id: nil, uri: nil) body = { loginId: login_id, URI: uri } post(Common::USER_GENERATE_ENCHANTED_LINK_FOR_TEST_PATH, body) end |
#generate_magic_link_for_test_user(method: nil, login_id: nil, uri: nil) ⇒ Object
485 486 487 488 489 490 491 492 |
# File 'lib/descope/api/v1/management/user.rb', line 485 def generate_magic_link_for_test_user(method: nil, login_id: nil, uri: nil) body = { loginId: login_id, deliveryMethod: get_method_string(method), URI: uri } post(Common::USER_GENERATE_MAGIC_LINK_FOR_TEST_PATH, body) end |
#generate_otp_for_test_user(method: nil, login_id: nil) ⇒ Object
477 478 479 480 481 482 483 |
# File 'lib/descope/api/v1/management/user.rb', line 477 def generate_otp_for_test_user(method: nil, login_id: nil) body = { loginId: login_id, deliveryMethod: get_method_string(method) } post(Common::USER_GENERATE_OTP_FOR_TEST_PATH, body) end |
#get_provider_token(login_id: nil, provider: nil) ⇒ Object
Get an existing user’s provider token, using a valid management key.
231 232 233 234 235 236 237 238 |
# File 'lib/descope/api/v1/management/user.rb', line 231 def get_provider_token(login_id: nil, provider: nil) path = Common::USER_GET_PROVIDER_TOKEN request_params = { loginId: login_id, provider: provider } get(path, request_params) end |
#invite_user(**args) ⇒ Object
Create a new user and invite them via an email message.
Functions exactly the same as the `create` function with the additional invitation
behavior. See the documentation above for the general creation behavior.
IMPORTANT: Since the invitation is sent by email, make sure either
the email is explicitly set, or the login_id itself is an email address.
You must configure the invitation URL in the Descope console prior to
calling the method.
57 58 59 60 |
# File 'lib/descope/api/v1/management/user.rb', line 57 def invite_user(**args) args[:invite] = true user_create(**args) end |
#load_by_user_id(user_id) ⇒ Object
Load a user’s data, using a valid management key by user id.
140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/descope/api/v1/management/user.rb', line 140 def load_by_user_id(user_id) # Retrieve user information based on the provided user ID # The user ID can be found on the user's JWT. validate_user_id(user_id) path = Common::USER_LOAD_PATH request_params = { userId: user_id } get(path, request_params) end |
#load_user(login_id) ⇒ Object
Load a user’s data, using a valid management key.
126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/descope/api/v1/management/user.rb', line 126 def load_user(login_id) @logger.debug("Loading user with login_id: #{login_id}") # Retrieve user information based on the provided Login ID validate_login_id(login_id) request_params = { loginId: login_id } path = Common::USER_LOAD_PATH get(path, request_params) end |
#logout_user(login_id) ⇒ Object
Log a user out of all sessions, using a valid management key.
154 155 156 157 158 159 160 161 |
# File 'lib/descope/api/v1/management/user.rb', line 154 def logout_user(login_id) validate_login_id(login_id) path = Common::USER_LOGOUT_PATH request_params = { loginId: login_id } post(path, request_params) end |
#logout_user_by_id(user_id) ⇒ Object
163 164 165 166 167 168 169 170 |
# File 'lib/descope/api/v1/management/user.rb', line 163 def logout_user_by_id(user_id) validate_user_id(user_id) path = Common::USER_LOGOUT_PATH request_params = { userId: user_id } post(path, request_params) end |
#map_to_values_object(input_map) ⇒ Object
222 223 224 225 226 227 |
# File 'lib/descope/api/v1/management/user.rb', line 222 def map_to_values_object(input_map) return {} unless input_map.is_a?(Hash) input_map.each_with_object({}) do |(key, values), result| result[key] = { values: Array(values) } end end |
#patch_user(login_id: nil, email: nil, phone: nil, name: nil, given_name: nil, middle_name: nil, family_name: nil, role_names: [], user_tenants: [], picture: nil, custom_attributes: nil, verified_email: nil, verified_phone: nil, additional_identifiers: [], password: nil, hashed_password: {}, sso_app_ids: []) ⇒ Object
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'lib/descope/api/v1/management/user.rb', line 338 def patch_user( login_id: nil, email: nil, phone: nil, name: nil, given_name: nil, middle_name: nil, family_name: nil, role_names: [], user_tenants: [], picture: nil, custom_attributes: nil, verified_email: nil, verified_phone: nil, additional_identifiers: [], password: nil, hashed_password: {}, sso_app_ids: [] ) validate_login_id(login_id) role_names ||= [] user_tenants ||= [] path = Common::USER_PATCH_PATH request_params = user_compose_update_body( login_id:, email:, phone:, name:, given_name:, middle_name:, family_name:, role_names:, user_tenants:, picture:, custom_attributes:, verified_email:, verified_phone:, additional_identifiers:, password:, hashed_password:, sso_app_ids: ) patch(path, request_params) end |
#search_all_test_users(tenant_ids: [], role_names: [], limit: 0, page: 0, custom_attributes: {}, statuses: [], emails: [], phones: [], sso_app_ids: [], sort: [], text: nil, login_ids: [], tenant_role_ids: {}, tenant_role_names: {}) ⇒ Hash
Search for all test users.
The “users” key contains a list of all the found users and their information
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
# File 'lib/descope/api/v1/management/user.rb', line 540 def search_all_test_users( tenant_ids: [], role_names: [], limit: 0, page: 0, custom_attributes: {}, statuses: [], emails: [], phones: [], sso_app_ids: [], sort: [], text: nil, login_ids: [], tenant_role_ids: {}, tenant_role_names: {} ) tenant_ids ||= [] role_names ||= [] if limit < 0 || page < 0 raise Descope::ArgumentException.new( 'limit or page must be non-negative', code: 400 ) end body = { tenantIds: tenant_ids, roleNames: role_names, limit:, page:, testUsersOnly: true, withTestUser: true } body[:statuses] = statuses unless statuses.nil? || statuses.empty? body[:emails] = emails unless emails.nil? || emails.empty? body[:phones] = phones unless phones.nil? || phones.empty? body[:customAttributes] = custom_attributes unless custom_attributes.nil? || custom_attributes.empty? body[:ssoAppIds] = sso_app_ids unless sso_app_ids.nil? || sso_app_ids.empty? body[:loginIds] = login_ids unless login_ids.nil? || login_ids.empty? body[:sort] = sort unless sort.nil? || sort.empty? body[:text] = text unless text.nil? || text.empty? body[:tenantRoleIds] = map_to_values_object(tenant_role_ids) unless tenant_role_ids.nil? || tenant_role_ids.empty? body[:tenantRoleNames] = map_to_values_object(tenant_role_names) unless tenant_role_names.nil? || tenant_role_names.empty? post(Common::TEST_USERS_SEARCH_PATH, body) end |
#search_all_users(login_id: nil, tenant_ids: [], role_names: [], text: nil, limit: 0, page: 0, sso_only: false, test_users_only: false, with_test_user: false, custom_attributes: {}, statuses: [], emails: [], phones: [], sso_app_ids: [], tenant_role_ids: {}, tenant_role_names: {}) ⇒ Object
Search for users, using a valid management key.
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 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/descope/api/v1/management/user.rb', line 174 def search_all_users( login_id: nil, tenant_ids: [], role_names: [], text: nil, limit: 0, page: 0, sso_only: false, test_users_only: false, with_test_user: false, custom_attributes: {}, statuses: [], emails: [], phones: [], sso_app_ids: [], tenant_role_ids: {}, tenant_role_names: {} ) body = { loginId: login_id, tenantIds: tenant_ids, roleNames: role_names, ssoOnly: sso_only, limit:, page:, text:, testUsersOnly: test_users_only, withTestUser: with_test_user, ssoAppIds: sso_app_ids, } body[:statuses] = statuses unless statuses.empty? body[:emails] = emails unless emails.empty? body[:phones] = phones unless phones.empty? body[:customAttributes] = custom_attributes unless custom_attributes.empty? body[:limit] = limit unless limit.zero? body[:page] = page unless page.zero? body[:text] = text unless text.nil? body[:testUsersOnly] = test_users_only unless test_users_only.nil? body[:withTestUser] = with_test_user unless with_test_user.nil? body[:ssoOnly] = sso_only unless sso_only.nil? body[:ssoAppIds] = sso_app_ids unless sso_app_ids.empty? body[:tenantIds] = tenant_ids unless tenant_ids.empty? body[:roleNames] = role_names unless role_names.empty? body[:tenantRoleIds] = map_to_values_object(tenant_role_ids) unless tenant_role_ids.nil? || tenant_role_ids.empty? body[:tenantRoleNames] = map_to_values_object(tenant_role_names) unless tenant_role_names.nil? || tenant_role_names.empty? post(Common::USERS_SEARCH_PATH, body) end |
#set_active_password(login_id: nil, password: nil) ⇒ Object
452 453 454 455 456 457 458 |
# File 'lib/descope/api/v1/management/user.rb', line 452 def set_active_password(login_id: nil, password: nil) body = { loginId: login_id, password: } post(Common::USER_SET_ACTIVE_PASSWORD_PATH, body) end |
#set_password(login_id: nil, password: nil) ⇒ Object
Deprecated (use set_temporary_password(..) instead)
461 462 463 464 465 466 467 |
# File 'lib/descope/api/v1/management/user.rb', line 461 def set_password(login_id: nil, password: nil) body = { loginId: login_id, password: } post(Common::USER_SET_PASSWORD_PATH, body) end |
#set_temporary_password(login_id: nil, password: nil) ⇒ Object
444 445 446 447 448 449 450 |
# File 'lib/descope/api/v1/management/user.rb', line 444 def set_temporary_password(login_id: nil, password: nil) body = { loginId: login_id, password: } post(Common::USER_SET_TEMPORARY_PASSWORD_PATH, body) end |
#update_custom_attribute(login_id: nil, attribute_key: nil, attribute_value: nil) ⇒ Object
Update an existing user’s custom attributes, using a valid management key.
328 329 330 331 332 333 334 335 336 |
# File 'lib/descope/api/v1/management/user.rb', line 328 def update_custom_attribute(login_id: nil, attribute_key: nil, attribute_value: nil) @logger.debug("Updating user's custom attribute with login_id: #{login_id} to #{attribute_key}: #{attribute_value}") body = { loginId: login_id, attributeKey: attribute_key, attributeValue: attribute_value } post(Common::USER_UPDATE_CUSTOM_ATTRIBUTE_PATH, body) end |
#update_display_name(login_id: nil, name: nil, given_name: nil, middle_name: nil, family_name: nil) ⇒ Object
Updates an existing user’s display name, using a valid management key.
301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'lib/descope/api/v1/management/user.rb', line 301 def update_display_name( login_id: nil, name: nil, given_name: nil, middle_name: nil, family_name: nil ) body = { loginId: login_id } body[:name] = name unless name.nil? body[:givenName] = given_name unless given_name.nil? body[:middleName] = middle_name unless middle_name.nil? body[:familyName] = family_name unless family_name.nil? post(Common::USER_UPDATE_NAME_PATH, body) end |
#update_email(login_id: nil, email: nil, verified: true) ⇒ Object
Updates an existing user’s email, using a valid management key.
276 277 278 279 280 281 282 283 284 285 |
# File 'lib/descope/api/v1/management/user.rb', line 276 def update_email(login_id: nil, email: nil, verified: true) @logger.debug("Updating user's email with login_id: #{login_id} to #{email} verified: #{verified}") path = Common::USER_UPDATE_EMAIL_PATH request_params = { loginId: login_id, email:, verified: } post(path, request_params) end |
#update_jwt(jwt: nil, custom_claims: nil) ⇒ Object
383 384 385 386 387 388 389 |
# File 'lib/descope/api/v1/management/user.rb', line 383 def update_jwt(jwt: nil, custom_claims: nil) body = { jwt:, customClaims: custom_claims, } post(Common::UPDATE_JWT_PATH, body) end |
#update_login_id(login_id: nil, new_login_id: nil) ⇒ Object
Updates an existing user’s login ID, using a valid management key.
264 265 266 267 268 269 270 271 272 |
# File 'lib/descope/api/v1/management/user.rb', line 264 def update_login_id(login_id: nil, new_login_id: nil) validate_login_id(login_id) path = Common::USER_UPDATE_LOGIN_ID_PATH request_params = { loginId: login_id, newLoginId: new_login_id } post(path, request_params) end |
#update_phone(login_id: nil, phone: nil, verified: true) ⇒ Object
Updates an existing user’s phone number, using a valid management key.
289 290 291 292 293 294 295 296 297 |
# File 'lib/descope/api/v1/management/user.rb', line 289 def update_phone(login_id: nil, phone: nil, verified: true) path = Common::USER_UPDATE_PHONE_PATH request_params = { loginId: login_id, phone:, verified: } post(path, request_params) end |
#update_picture(login_id: nil, picture: nil) ⇒ Object
Update an existing user’s profile picture, using a valid management key.
318 319 320 321 322 323 324 |
# File 'lib/descope/api/v1/management/user.rb', line 318 def update_picture(login_id: nil, picture: nil) body = { loginId: login_id, picture: picture } post(Common::USER_UPDATE_PICTURE_PATH, body) end |
#update_user(login_id: nil, email: nil, phone: nil, name: nil, given_name: nil, middle_name: nil, family_name: nil, role_names: [], user_tenants: [], picture: nil, custom_attributes: nil, verified_email: nil, verified_phone: nil, additional_identifiers: [], password: nil, hashed_password: {}, sso_app_ids: []) ⇒ Object
Updates a user’s details, using a valid management key.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/descope/api/v1/management/user.rb', line 64 def update_user( login_id: nil, email: nil, phone: nil, name: nil, given_name: nil, middle_name: nil, family_name: nil, role_names: [], user_tenants: [], picture: nil, custom_attributes: nil, verified_email: nil, verified_phone: nil, additional_identifiers: [], password: nil, hashed_password: {}, sso_app_ids: [] ) role_names ||= [] user_tenants ||= [] path = Common::USER_UPDATE_PATH request_params = user_compose_update_body( login_id:, email:, phone:, name:, given_name:, middle_name:, family_name:, role_names:, user_tenants:, picture:, custom_attributes:, verified_email:, verified_phone:, additional_identifiers:, password:, hashed_password:, sso_app_ids: ) post(path, request_params) end |
#user_add_roles(login_id: nil, tenant_id: nil, role_names: []) ⇒ Object
392 393 394 395 396 397 398 399 |
# File 'lib/descope/api/v1/management/user.rb', line 392 def user_add_roles(login_id: nil, tenant_id: nil, role_names: []) body = { loginId: login_id, roleNames: role_names, tenantId: tenant_id } post(Common::USER_ADD_ROLE_PATH, body) end |
#user_add_tenant(login_id: nil, tenant_id: nil) ⇒ Object
410 411 412 413 414 415 416 |
# File 'lib/descope/api/v1/management/user.rb', line 410 def user_add_tenant(login_id: nil, tenant_id: nil) body = { loginId: login_id, tenantId: tenant_id } post(Common::USER_ADD_TENANT_PATH, body) end |
#user_remove_roles(login_id: nil, tenant_id: nil, role_names: []) ⇒ Object
401 402 403 404 405 406 407 408 |
# File 'lib/descope/api/v1/management/user.rb', line 401 def user_remove_roles(login_id: nil, tenant_id:nil, role_names: []) body = { loginId: login_id, roleNames: role_names, tenantId: tenant_id } post(Common::USER_REMOVE_ROLE_PATH, body) end |
#user_remove_tenant(login_id: nil, tenant_id: nil) ⇒ Object
418 419 420 421 422 423 424 |
# File 'lib/descope/api/v1/management/user.rb', line 418 def user_remove_tenant(login_id: nil, tenant_id: nil) body = { loginId: login_id, tenantId: tenant_id } post(Common::USER_REMOVE_TENANT_PATH, body) end |
#user_remove_tenant_roles(login_id: nil, tenant_id: nil, role_names: []) ⇒ Object
435 436 437 438 439 440 441 442 |
# File 'lib/descope/api/v1/management/user.rb', line 435 def user_remove_tenant_roles(login_id: nil, tenant_id: nil, role_names: []) body = { loginId: login_id, tenantId: tenant_id, roleNames: role_names } post(Common::USER_REMOVE_TENANT_PATH, body) end |