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_active_job, define_event_method, define_event_perform_later_method, define_on_format, ensure_set, event, extended, format, process_base_module_list, process_base_modules, register_set, register_set_format, shortname, view, write_tmp_file

Methods included from All::Permissions::Accounts

#permit

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


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

def active?   ; status=='active'  end

#authenticate_by_token(val) ⇒ Object



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

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  # > means "after"
  left and left.accountable?                       or return :illegal_account  #(overkill?)
  Auth.as_bot { tcard.delete! }
  left.id
end

#blocked?Boolean

Returns:

  • (Boolean)


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

def blocked?  ; status=='blocked' end

#built_in?Boolean

Returns:

  • (Boolean)


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

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
  return 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



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

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

#has_reset_token?Boolean

Returns:

  • (Boolean)


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

def has_reset_token?
  @env_token = Env.params[:reset_token]
end

#ok_to_readObject



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

def ok_to_read
  is_own_account? ? true : super
end

#pending?Boolean

Returns:

  • (Boolean)


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

def pending?  ; status=='pending' end

#send_change_notice(act, followed_set, follow_option) ⇒ Object



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

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