Class: Caboose::SmtpController
Instance Method Summary
collapse
#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
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
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# 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
when 'from_address' then sc.from_address = value
end
end
resp.success = save && sc.save
render :json => resp
end
|