Module: MailManager
- Defined in:
- app/models/mail_manager/bounce.rb,
app/models/mail_manager.rb,
lib/mail_manager/engine.rb,
lib/mail_manager/version.rb,
app/models/mail_manager/mailer.rb,
app/models/mail_manager/contact.rb,
app/models/mail_manager/mailing.rb,
app/models/mail_manager/message.rb,
lib/workers/mail_manager/bounce_job.rb,
app/models/mail_manager/mailing_list.rb,
app/models/mail_manager/subscription.rb,
app/models/mail_manager/test_message.rb,
lib/workers/mail_manager/mailing_job.rb,
lib/workers/mail_manager/message_job.rb,
app/helpers/mail_manager/layout_helper.rb,
app/models/mail_manager/mailable_registry.rb,
lib/workers/mail_manager/test_message_job.rb,
app/helpers/mail_manager/application_helper.rb,
app/models/mail_manager/contactable_registry.rb,
app/helpers/mail_manager/subscriptions_helper.rb,
app/controllers/mail_manager/bounces_controller.rb,
app/controllers/mail_manager/contacts_controller.rb,
app/controllers/mail_manager/mailings_controller.rb,
app/controllers/mail_manager/messages_controller.rb,
app/controllers/mail_manager/application_controller.rb,
app/controllers/mail_manager/mailing_lists_controller.rb,
app/controllers/mail_manager/subscriptions_controller.rb
Overview
- Author
-
Chris Hauboldt ([email protected])
- Copyright
-
2009 Lone Star Internet Inc.
Worker used to check for ready Mailings and process/send them.
Defined Under Namespace
Modules: ApplicationHelper, LayoutHelper, SubscriptionsHelper Classes: ApplicationController, Bounce, BounceJob, BouncesController, Config, Contact, ContactableRegistry, ContactsController, Engine, Mailable, MailableRegistry, Mailer, Mailing, MailingJob, MailingList, MailingListsController, MailingsController, Message, MessageJob, MessagesController, Subscription, SubscriptionsController, TestMessage, TestMessageJob
Constant Summary collapse
- PLUGIN_ROOT =
used to easily know where the mail manager gem files are
File.(File.join(File.dirname(__FILE__),'..','..'))
- VERSION =
"3.2.4"- Lock =
WithLock::Client
- LockException =
WithLock::LockException
Class Method Summary collapse
-
.abilities ⇒ Object
can be used to inject cancan abilities into your application.
-
.assets_path ⇒ Object
easily get a path to the gem’s assets.
-
.authorized?(user) ⇒ Boolean
logic for authorization mail manager.
-
.authorized_for_roles?(user, roles = []) ⇒ Boolean
checks if the given ‘user’ has a role.
-
.edit_route_for(contactable) ⇒ Object
gives the url for a contactable object (such as users or members or whatever you set up for mapping to your contacts.
-
.initialize_with_config(conf) ⇒ Object
sets up your MailManager.blah configuration options from config/mail_manager.yml and can override those with config/mail_manager.local.yml for development environments.
Class Method Details
.abilities ⇒ Object
can be used to inject cancan abilities into your application
108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/mail_manager/engine.rb', line 108 def self.abilities " if MailManager.authorized?(user)\n can :manage, [\n MailManager::Mailing,\n MailManager::MailingList,\n MailManager::Contact,\n MailManager::Subscription,\n MailManager::Bounce,\n MailManager::Message\n ]\n end\n EOT\nend\n" |
.assets_path ⇒ Object
easily get a path to the gem’s assets
130 131 132 |
# File 'lib/mail_manager/engine.rb', line 130 def self.assets_path File.join(PLUGIN_ROOT,'assets') end |
.authorized?(user) ⇒ Boolean
logic for authorization mail manager
100 101 102 103 104 105 |
# File 'lib/mail_manager/engine.rb', line 100 def self.(user) return true unless ::MailManager.requires_authentication return false if user.blank? return true unless ::MailManager..present? (user, ::MailManager.) end |
.authorized_for_roles?(user, roles = []) ⇒ Boolean
checks if the given ‘user’ has a role
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/mail_manager/engine.rb', line 79 def self.(user,roles=[]) return true unless roles.present? user_roles = if ::MailManager.roles_method.present? if user.respond_to? ::MailManager.roles_method user.send(::MailManager.roles_method) else false end elsif user.respond_to?(:roles) user.roles elsif user.respond_to?(:role) [user.role] else [] end return false unless user_roles.present? user_roles = [user_roles] unless user_roles.is_a?(Array) roles.detect{|role| user_roles.map(&:to_sym).map(&:to_s).include?(role.to_s)}.present? end |
.edit_route_for(contactable) ⇒ Object
gives the url for a contactable object (such as users or members or whatever you set up for mapping to your contacts
125 126 127 |
# File 'lib/mail_manager/engine.rb', line 125 def self.edit_route_for(contactable) ContactableRegistry.edit_route_for(contactable.is_a?(String) ? contactable : contactable.class.name) end |
.initialize_with_config(conf) ⇒ Object
sets up your MailManager.blah configuration options from config/mail_manager.yml and can override those with config/mail_manager.local.yml for development environments
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/mail_manager/engine.rb', line 137 def self.initialize_with_config(conf) MailManager.secret ||= conf.secret rescue nil = ActionController::Base. default_site_url = "#{default_url_options[:protocol]||'http'}://#{default_url_options[:domain]}" MailManager.site_url ||= conf.site_url || default_site_url rescue default_site_url MailManager.dont_include_images_domains ||= conf.dont_include_images_domains || [] rescue [] MailManager. ||= conf. || 0.3 rescue 0.3 MailManager.table_prefix ||= conf.table_prefix || 'mail_manager_' rescue 'mail_manager_' MailManager.default_from_email_address ||= conf.default_from_email_address rescue nil MailManager.signup_email_address ||= conf.signup_email_address rescue nil MailManager.bounce ||= conf.bounce || {} rescue {} MailManager.unsubscribe_path ||= conf.unsubscribe_path || "/listmgr" rescue "/listmgr" MailManager.subscribe_path ||= conf.subscribe_path || "/listmgr/subscribe" rescue "/listmgr/subscribe" MailManager.double_opt_in_path ||= conf.double_opt_in_path || "/listmgr/confirm" rescue "/listmgr/confirm" MailManager.honey_pot_field ||= conf.honey_pot_field || "company_name" rescue "company_name" MailManager.subscribe_thank_you_path ||= conf.subscribe_thank_you_path || "/listmgr/subscribe_thank_you" rescue "/listmgr/subscribe_thank_you" MailManager.site_path ||= conf.site_path || "/" rescue "/" MailManager.layout ||= conf.layout || "mail_manager/application" rescue "mail_manager/application" MailManager.public_layout ||= conf.public_layout || "mail_manager/application" rescue "mail_manager/application" MailManager.use_show_for_resources ||= conf.use_show_for_resources || false rescue false MailManager.show_title ||= conf.show_title || true rescue true MailManager.requires_authentication ||= conf.requires_authentication || false rescue false MailManager. ||= conf. || [] rescue [] MailManager.roles_method ||= conf.roles_method || nil rescue nil MailManager.exception_notification = {} MailManager.exception_notification[:to_addresses] ||= conf.exception_notification['to_addresses'] || [] rescue [] MailManager.exception_notification[:from_address] ||= conf.exception_notification['from_address'] || nil rescue nil end |