Class: Caboose::SmtpController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Caboose::SmtpController
- Defined in:
- app/controllers/caboose/smtp_controller.rb
Instance Method Summary collapse
-
#admin_edit ⇒ Object
GET /admin/smtp.
-
#admin_update ⇒ Object
PUT /admin/smtp.
-
#auth_options ⇒ Object
GET /admin/smtp/auth-options.
Methods inherited from ApplicationController
#add_ga_event, #admin_add, #admin_bulk_add, #admin_bulk_delete, #admin_bulk_update, #admin_delete, #admin_index, #admin_json, #admin_json_single, #before_action, #before_before_action, #hashify_query_string, #init_cart, #logged_in?, #logged_in_user, #login_user, #logout_user, #parse_url_params, #reject_param, #under_construction_or_forwarding_domain?, #user_is_allowed, #user_is_allowed_to, #validate_cookie, #validate_token, #var, #verify_logged_in
Instance Method Details
#admin_edit ⇒ Object
GET /admin/smtp
8 9 10 11 12 |
# File 'app/controllers/caboose/smtp_controller.rb', line 8 def admin_edit return if !user_is_allowed('smtp', 'edit') @smtp_config = @site.smtp_config @smtp_config = SmtpConfig.create(:site_id => @site.id) if @smtp_config.nil? end |
#admin_update ⇒ Object
PUT /admin/smtp
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/caboose/smtp_controller.rb', line 15 def admin_update return if !user_is_allowed('sites', 'edit') resp = StdClass.new sc = @site.smtp_config sc = SmtpConfig.create(:site_id => @site.id) if sc.nil? save = true params.each do |name,value| case name when 'site_id' then sc.site_id = value when 'address' then sc.address = value when 'port' then sc.port = value when 'domain' then sc.domain = value when 'user_name' then sc.user_name = value when 'password' then sc.password = value when 'authentication' then sc.authentication = value when 'enable_starttls_auto' then sc.enable_starttls_auto = value end end resp.success = save && sc.save render :json => resp end |
#auth_options ⇒ Object
GET /admin/smtp/auth-options
41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/caboose/smtp_controller.rb', line 41 def return if !user_is_allowed('smtp', 'view') = [ { 'value' => SmtpConfig::AUTH_PLAIN , 'text' => SmtpConfig::AUTH_PLAIN }, { 'value' => SmtpConfig::AUTH_LOGIN , 'text' => SmtpConfig::AUTH_LOGIN }, { 'value' => SmtpConfig::AUTH_MD5 , 'text' => SmtpConfig::AUTH_MD5 } ] render :json => end |