Module: Card::Set::Type::User

Extended by:
Card::Set
Defined in:
card/tmpsets/set/mod025-card-mod-follow/type/user.rb,
card/tmpsets/set/mod011-card-mod-account/type/user.rb,
card/tmpsets/set/mod026-card-mod-follow/type/user.rb,
card/tmpsets/set/mod010-card-mod-account/type/user.rb

Overview

Set: All “User” cards

Defined Under Namespace

Modules: HtmlFormat

Constant Summary

Constants included from Helpers

Helpers::SET_PATTERN_TEST_REGEXP

Constants included from Event::Api

Event::Api::OPTIONS

Instance Attribute Summary collapse

Class Method Summary collapse

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

Methods included from AdvancedApi

#attachment, #define_set_from_error, #ensure_set, #setting_opts, #stage_method

Methods included from Format

#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Basket

#abstract_basket, #add_to_basket, #basket, #unshift_basket

Methods included from Card::Set::Trait

#card_accessor, #card_reader, #card_writer, #require_field

Methods included from Event::Api

#event

Instance Attribute Details

#emailObject

Returns the value of attribute email.



10
11
12
# File 'card/tmpsets/set/mod011-card-mod-account/type/user.rb', line 10

def email
  @email
end

Class Method Details

.source_locationObject



7
# File 'card/tmpsets/set/mod025-card-mod-follow/type/user.rb', line 7

def self.source_location; "/Users/ethan/dev/decko/gem/card-mod-follow/set/type/user.rb"; end

Instance Method Details

#event: setup_as_botObject



55
56
57
58
59
60
61
# File 'card/tmpsets/set/mod011-card-mod-account/type/user.rb', line 55

event :setup_as_bot, before: :check_permissions, on: :create, when: :setup? do
  abort :failure unless Auth.needs_setup?
  Auth.as_bot
  # we need bot authority to set the initial administrator roles
  # this is granted and inspected here as a separate event for
  # flexibility and security when configuring initial setups
end

#event: setup_first_userObject



63
64
65
66
# File 'card/tmpsets/set/mod011-card-mod-account/type/user.rb', line 63

event :setup_first_user, :prepare_to_store, on: :create, when: :setup? do
  add_subcard "signup alert email+*to", content: name
  add_subfield :roles, content: roles_for_first_user
end

#event: signin_after_setupObject



72
73
74
# File 'card/tmpsets/set/mod011-card-mod-account/type/user.rb', line 72

event :signin_after_setup, :integrate, on: :create, when: :setup? do
  Auth. id
end

#follow(follow_name, option = "*always") ⇒ Object



8
9
10
11
12
13
14
# File 'card/tmpsets/set/mod025-card-mod-follow/type/user.rb', line 8

def follow follow_name, option="*always"
  return unless (follow_rule = Card.fetch(follow_name)&.follow_rule_card(name, new: {}))

  follow_rule.drop_item "*never"
  follow_rule.add_item option
  follow_rule.save!
end

#roles_for_first_userObject



68
69
70
# File 'card/tmpsets/set/mod011-card-mod-account/type/user.rb', line 68

def roles_for_first_user
  %i[help_desk shark administrator].map(&:cardname)
end

#setup?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'card/tmpsets/set/mod011-card-mod-account/type/user.rb', line 51

def setup?
  Card::Env.params[:setup]
end