Module: Card::Set::Right::Account
Instance Method Summary
collapse
Methods included from Card::Set
abstract_set?, all_set?, card_accessor, card_reader, card_writer, clean_empty_module_from_hash, clean_empty_modules, define_active_job, define_event_method, define_event_perform_later_method, define_on_format, ensure_set, event, extended, format, phase_method, process_base_module_list, process_base_modules, register_set, register_set_format, shortname, view, write_tmp_file
#permit
Instance Method Details
#active? ⇒ Boolean
13
|
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 13
def active? ; status=='active' end
|
#authenticate_by_token(val) ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 19
def authenticate_by_token val
tcard = token_card or return :token_not_found
token == val or return :incorrect_token
tcard.updated_at > Card.config.token_expiry.ago or return :token_expired left and left.accountable? or return :illegal_account Auth.as_bot { tcard.delete! }
left.id
end
|
#blocked? ⇒ Boolean
14
|
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 14
def blocked? ; status=='blocked' end
|
#built_in? ⇒ Boolean
15
|
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 15
def built_in? ; status=='system' end
|
#changes_visible?(act) ⇒ Boolean
156
157
158
159
160
161
|
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 156
def changes_visible? act
act.relevant_actions_for(act.card).each do |action|
return true if action.card.ok? :read
end
return false
end
|
#confirm_ok? ⇒ Boolean
88
89
90
|
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 88
def confirm_ok?
Card.new( type_id: Card.default_accounted_type_id ).ok? :create
end
|
#edit_password_success_args ⇒ Object
115
116
117
118
119
120
121
|
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 115
def edit_password_success_args
{
id: left.name,
view: :related,
related: { name: "+#{Card[:account].name}", view: 'edit' }
}
end
|
#has_reset_token? ⇒ Boolean
123
124
125
|
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 123
def has_reset_token?
@env_token = Env.params[:reset_token]
end
|
#ok_to_read ⇒ Object
151
152
153
|
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 151
def ok_to_read
is_own_account? ? true : super
end
|
#pending? ⇒ Boolean
16
|
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 16
def pending? ; status=='pending' end
|
#send_change_notice(act, followed_set, follow_option) ⇒ Object
163
164
165
166
167
168
169
170
171
172
173
174
175
|
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 163
def send_change_notice act, followed_set, follow_option
if 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
end
|