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

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

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_on_format, ensure_set, extended, format, process_base_module_list, process_base_modules, register_set, register_set_format, shortname, stage_method, view, write_tmp_file

Methods included from Event

#define_event, #event

Methods included from All::Permissions::Accounts

#permit

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


13
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 13

def active?;   status == 'active'  end

#blocked?Boolean

Returns:

  • (Boolean)


14
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 14

def blocked?;  status == 'blocked' end

#built_in?Boolean

Returns:

  • (Boolean)


15
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 15

def built_in?; status == 'system'  end

#changes_visible?(act) ⇒ Boolean

Returns:

  • (Boolean)


155
156
157
158
159
160
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 155

def changes_visible? act
  act.relevant_actions_for(act.card).each do |action|
    return true if action.card.ok? :read
  end
  false
end

#confirm_ok?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 87

def confirm_ok?
  Card.new(type_id: Card.default_accounted_type_id).ok? :create
end

#edit_password_success_argsObject



113
114
115
116
117
118
119
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 113

def edit_password_success_args
  {
    id: left.name,
    view: :related,
    related: { name: "+#{Card[:account].name}", view: 'edit' }
  }
end

#ok_to_readObject



151
152
153
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 151

def ok_to_read
  own_account? ? true : super
end

#pending?Boolean

Returns:

  • (Boolean)


16
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 16

def pending?;  status == 'pending' end

#reset_password?Boolean

Returns:

  • (Boolean)


121
122
123
124
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 121

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



162
163
164
165
166
167
168
169
170
171
172
173
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 162

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



18
19
20
21
22
23
# File 'tmpsets/set/mod007-05_standard/right/account.rb', line 18

def validate_token! test_token
  tcard = token_card
  tcard.validate! test_token
  copy_errors tcard
  errors.empty?
end