diff --git a/app/controllers/admin/bounced_mail_addresses_controller.rb b/app/controllers/admin/bounced_mail_addresses_controller.rb new file mode 100644 index 000000000..a33f90ab3 --- /dev/null +++ b/app/controllers/admin/bounced_mail_addresses_controller.rb @@ -0,0 +1,60 @@ +module Admin + class BouncedMailAddressesController < BaseController + before_action :set_bounced_mail_address, only: %i[show edit update destroy] + load_and_authorize_resource + + # GET /bounced_mail_addresses + def index + @bounced_mail_addresses = BouncedMailAddress.all + end + + # GET /bounced_mail_addresses/1 + def show; end + + # GET /bounced_mail_addresses/new + def new + @bounced_mail_address = BouncedMailAddress.new + end + + # GET /bounced_mail_addresses/1/edit + def edit; end + + # POST /bounced_mail_addresses + def create + @bounced_mail_address = BouncedMailAddress.new(bounced_mail_address_params) + + if @bounced_mail_address.save + redirect_to(admin_bounced_mail_addresses_url, notice: 'Bounced mail address was successfully created.') + else + render(:new) + end + end + + # PATCH/PUT /bounced_mail_addresses/1 + def update + if @bounced_mail_address.update(bounced_mail_address_params) + redirect_to(@bounced_mail_address, notice: 'Bounced mail address was successfully updated.') + else + render(:edit) + end + end + + # DELETE /bounced_mail_addresses/1 + def destroy + @bounced_mail_address.destroy + redirect_to(admin_bounced_mail_addresses_url, notice: 'Bounced mail address was successfully destroyed.') + end + + private + + # Use callbacks to share common setup or constraints between actions. + def set_bounced_mail_address + @bounced_mail_address = BouncedMailAddress.find(params[:id]) + end + + # Only allow a trusted parameter "white list" through. + def bounced_mail_address_params + params.require(:bounced_mail_address).permit(:email, :bounce_reason, :incidents, :response_json) + end + end +end diff --git a/app/models/ability.rb b/app/models/ability.rb index dce8a515b..31637b8ea 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -109,6 +109,7 @@ class Ability can :destroy, :pending can :create, :zonefile can :access, :settings_menu + can :manage, BouncedMailAddress end def static_registrant diff --git a/app/models/bounced_mail_address.rb b/app/models/bounced_mail_address.rb new file mode 100644 index 000000000..d8f6a037b --- /dev/null +++ b/app/models/bounced_mail_address.rb @@ -0,0 +1,2 @@ +class BouncedMailAddress < ApplicationRecord +end diff --git a/app/views/admin/bounced_mail_addresses/_form.html.erb b/app/views/admin/bounced_mail_addresses/_form.html.erb new file mode 100644 index 000000000..7a384bd3f --- /dev/null +++ b/app/views/admin/bounced_mail_addresses/_form.html.erb @@ -0,0 +1,37 @@ +<%= form_for([:admin, @bounced_mail_address], html: { class: 'form-horizontal' }) do |form| %> + <% if @bounced_mail_address.errors.any? %> +
+

<%= pluralize(bounced_mail_address.errors.count, "error") %> prohibited this bounced_mail_address from being saved:

+ + +
+ <% end %> + +
+ <%= form.label :email %> + <%= form.text_field :email %> +
+ +
+ <%= form.label :bounce_reason %> + <%= form.text_field :bounce_reason %> +
+ +
+ <%= form.label :incidents %> + <%= form.number_field :incidents %> +
+ +
+ <%= form.label :response_json %> + <%= form.text_field :response_json %> +
+ +
+ <%= form.submit %> +
+<% end %> diff --git a/app/views/admin/bounced_mail_addresses/edit.html.erb b/app/views/admin/bounced_mail_addresses/edit.html.erb new file mode 100644 index 000000000..a3dfe2d84 --- /dev/null +++ b/app/views/admin/bounced_mail_addresses/edit.html.erb @@ -0,0 +1,6 @@ +

Editing Bounced Mail Address

+ +<%= render 'form', bounced_mail_address: @bounced_mail_address %> + +<%= link_to 'Show', admin_bounced_mail_address_path(@bounced_mail_address)%> | +<%= link_to 'Back', admin_bounced_mail_addresses_path %> diff --git a/app/views/admin/bounced_mail_addresses/index.html.erb b/app/views/admin/bounced_mail_addresses/index.html.erb new file mode 100644 index 000000000..c2f95ca68 --- /dev/null +++ b/app/views/admin/bounced_mail_addresses/index.html.erb @@ -0,0 +1,33 @@ +

<%= notice %>

+ +

Bounced Mail Addresses

+ + + + + + + + + + + + + + <% @bounced_mail_addresses.each do |mail_addr| %> + + + + + + + + + + <% end %> + +
EmailBounce reasonIncidentsResponse json
<%= mail_addr.email %><%= mail_addr.bounce_reason %><%= mail_addr.incidents %><%= mail_addr.response_json %><%= link_to 'Show', admin_bounced_mail_address_path(mail_addr) %><%= link_to 'Edit', edit_admin_bounced_mail_address_path(mail_addr) %><%= link_to 'Destroy', admin_bounced_mail_address_path(mail_addr), method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Bounced Mail Address', new_admin_bounced_mail_address_path %> diff --git a/app/views/admin/bounced_mail_addresses/new.html.erb b/app/views/admin/bounced_mail_addresses/new.html.erb new file mode 100644 index 000000000..010ac79dc --- /dev/null +++ b/app/views/admin/bounced_mail_addresses/new.html.erb @@ -0,0 +1,5 @@ +

New Bounced Mail Address

+ +<%= render 'form', bounced_mail_address: @bounced_mail_address %> + +<%= link_to 'Back', admin_bounced_mail_addresses_path %> diff --git a/app/views/admin/bounced_mail_addresses/show.html.erb b/app/views/admin/bounced_mail_addresses/show.html.erb new file mode 100644 index 000000000..1f48ad5cf --- /dev/null +++ b/app/views/admin/bounced_mail_addresses/show.html.erb @@ -0,0 +1,24 @@ +

<%= notice %>

+ +

+ Email: + <%= @bounced_mail_address.email %> +

+ +

+ Bounce reason: + <%= @bounced_mail_address.bounce_reason %> +

+ +

+ Incidents: + <%= @bounced_mail_address.incidents %> +

+ +

+ Response json: + <%= @bounced_mail_address.response_json %> +

+ +<%= link_to 'Edit', edit_admin_bounced_mail_address_path(@bounced_mail_address) %> | +<%= link_to 'Back', admin_bounced_mail_addresses_path %> diff --git a/config/routes.rb b/config/routes.rb index 223cf3171..cdbd63f31 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -298,6 +298,7 @@ Rails.application.routes.draw do resources :delayed_jobs resources :epp_logs resources :repp_logs + resources :bounced_mail_addresses authenticate :admin_user do mount Que::Web, at: 'que'