Class: OauthIm::ProxyUser
Instance Attribute Summary collapse
Attributes inherited from IdpClient
#api_key, #idp_url
Class Method Summary
collapse
Instance Method Summary
collapse
#active?, #application_id, #email, #first_name, #full_name, #last_name, #login_id, #registration, #registration_data, #registrations, #sponsor?, #user_is_sponsor?
Methods inherited from IdpClient
default_api_key, default_idp_url
Constructor Details
#initialize(opts) ⇒ ProxyUser
Returns a new instance of ProxyUser.
20
21
22
23
24
|
# File 'app/services/oauth_im/proxy_user.rb', line 20
def initialize(opts)
@attrs = (opts || {}).to_h.with_indifferent_access
super api_key: @attrs[:api_key],
idp_url: @attrs[:idp_url]
end
|
Instance Attribute Details
#attrs ⇒ Object
Returns the value of attribute attrs.
18
19
20
|
# File 'app/services/oauth_im/proxy_user.rb', line 18
def attrs
@attrs
end
|
Class Method Details
.for(user_id:) ⇒ Object
14
15
16
|
# File 'app/services/oauth_im/proxy_user.rb', line 14
def self.for(user_id:)
AdminClient.new.proxy_user_for user_id: user_id
end
|
Instance Method Details
#deactivate ⇒ Object
51
52
53
54
|
# File 'app/services/oauth_im/proxy_user.rb', line 51
def deactivate
client.deactivate_user user_id
reset_attrs
end
|
26
27
28
|
# File 'app/services/oauth_im/proxy_user.rb', line 26
def
update_registration { |data| data[:sponsor] = 'true' }
end
|
#reactivate ⇒ Object
56
57
58
59
|
# File 'app/services/oauth_im/proxy_user.rb', line 56
def reactivate
client.reactivate_user user_id
reset_attrs
end
|
30
31
32
|
# File 'app/services/oauth_im/proxy_user.rb', line 30
def
update_registration { |data| data[:sponsor] = 'false' }
end
|
#send_reset_password_email ⇒ Object
42
43
44
45
|
# File 'app/services/oauth_im/proxy_user.rb', line 42
def send_reset_password_email
client.forgot_password loginId: login_id
reset_attrs
end
|
#set_password(password, change_required: true) ⇒ Object
47
48
49
|
# File 'app/services/oauth_im/proxy_user.rb', line 47
def set_password(password, change_required: true)
update_user(password: password, passwordChangeRequired: change_required)
end
|
#to_h ⇒ Object
34
35
36
|
# File 'app/services/oauth_im/proxy_user.rb', line 34
def to_h
os_to_h attrs
end
|
#user_id ⇒ Object
38
39
40
|
# File 'app/services/oauth_im/proxy_user.rb', line 38
def user_id
attrs[:id]
end
|