Module: Card::Set::Right::Account

Extended by:
Card::Set
Includes:
All::Permissions::Accounts
Defined in:
tmpsets/set/mod017-account/right/account.rb

Instance Method Summary collapse

Methods included from I18nScope

#mod_name, #scope

Methods included from Loader

#clean_empty_module_from_hash, #clean_empty_modules, #extended, #pattern_and_modules_from_path, #process_base_modules, #register_set, #tmp_file_frame, #tmp_file_template, #tmp_file_wrapped_content, #write_tmp_file

Methods included from Helpers

#abstract_set?, #all_set?, #shortname

Methods included from AdvancedApi

#attachment, #ensure_set, #stage_method

Methods included from Format

#all_set_format_mod!, #define_on_format, #format, #register_set_format, #view

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Basket

#abstract_basket, #add_to_basket, #basket

Methods included from Trait

#card_accessor, #card_reader, #card_writer

Methods included from Event

#event

Methods included from All::Permissions::Accounts

#permit

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'tmpsets/set/mod017-account/right/account.rb', line 13

def active?
  status == "active"
end

#blocked?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'tmpsets/set/mod017-account/right/account.rb', line 17

def blocked?
  status == "blocked"
end

#built_in?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'tmpsets/set/mod017-account/right/account.rb', line 21

def built_in?
  status == "system"
end

#changes_visible?(act) ⇒ Boolean

Returns:

  • (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

Returns:

  • (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_argsObject



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_readObject



163
164
165
# File 'tmpsets/set/mod017-account/right/account.rb', line 163

def ok_to_read
  own_account? ? true : super
end

#pending?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'tmpsets/set/mod017-account/right/account.rb', line 25

def pending?
  status == "pending"
end

#reset_password?Boolean

Returns:

  • (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