Module: Card::Set::Right::Account
Constant Summary
Constants included
from Helpers
Helpers::SET_PATTERN_TEST_REGEXP
Instance Method Summary
collapse
Methods included from Card::Set
reset_modules
Methods included from I18nScope
#mod_name, #scope
Methods included from Loader
#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set
Methods included from Helpers
#method_missing, #num_set_parts, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscore
#attachment, #ensure_set, #stage_method
Methods included from Format
#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name
#include_set, #include_set_formats
Methods included from Basket
#abstract_basket, #add_to_basket, #basket, #unshift_basket
Methods included from Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
#event
#permit
Instance Method Details
#active? ⇒ Boolean
13
14
15
|
# File 'tmpsets/set/mod017-account/right/account.rb', line 13
def active?
status == "active"
end
|
#blocked? ⇒ Boolean
17
18
19
|
# File 'tmpsets/set/mod017-account/right/account.rb', line 17
def blocked?
status == "blocked"
end
|
#built_in? ⇒ Boolean
21
22
23
|
# File 'tmpsets/set/mod017-account/right/account.rb', line 21
def built_in?
status == "system"
end
|
#changes_visible?(act) ⇒ Boolean
167
168
169
170
171
172
|
# File 'tmpsets/set/mod017-account/right/account.rb', line 167
def changes_visible? act
act.actions_affecting(act.card).each do |action|
return true if action.card.ok? :read
end
false
end
|
#confirm_ok? ⇒ Boolean
99
100
101
|
# File 'tmpsets/set/mod017-account/right/account.rb', line 99
def confirm_ok?
Card.new(type_id: Card.default_accounted_type_id).ok? :create
end
|
#edit_password_success_args ⇒ Object
125
126
127
128
129
130
131
|
# File 'tmpsets/set/mod017-account/right/account.rb', line 125
def edit_password_success_args
{
id: left.name,
view: :related,
related: { name: "+#{Card[:account].name}", view: "edit" }
}
end
|
#ok_to_read ⇒ Object
163
164
165
|
# File 'tmpsets/set/mod017-account/right/account.rb', line 163
def ok_to_read
own_account? ? true : super
end
|
#pending? ⇒ Boolean
25
26
27
|
# File 'tmpsets/set/mod017-account/right/account.rb', line 25
def pending?
status == "pending"
end
|
#reset_password? ⇒ Boolean
133
134
135
136
|
# File 'tmpsets/set/mod017-account/right/account.rb', line 133
def reset_password?
@env_token = Env.params[:token]
@env_token && Env.params[:event] == "reset_password"
end
|
#send_change_notice(act, followed_set, follow_option) ⇒ Object
174
175
176
177
178
179
180
181
182
183
184
185
|
# File 'tmpsets/set/mod017-account/right/account.rb', line 174
def send_change_notice act, followed_set, follow_option
return unless changes_visible?(act)
Auth.as(left.id) do
Card[:follower_notification_email].deliver(
context: act.card,
to: email,
follower: left.name,
followed_set: followed_set,
follow_option: follow_option
)
end
end
|
#validate_token!(test_token) ⇒ Object
29
30
31
32
33
34
|
# File 'tmpsets/set/mod017-account/right/account.rb', line 29
def validate_token! test_token
tcard = token_card
tcard.validate! test_token
copy_errors tcard
errors.empty?
end
|