summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-02-10 08:09:05 +0000
committerPeter Kozak <spag@golwen.net>2013-02-10 08:09:05 +0000
commit4c9cc92c0a49ec34c8bf00e31d1710450fb533fa (patch)
tree938c21ad5fece8a5b36c2689e5f7f8b50ca72e29 /app
parent5fba89e83722e11232b1130a1a939d55aed94387 (diff)
firewall blacklist model added
Diffstat (limited to 'app')
-rw-r--r--app/controllers/intruders_controller.rb41
-rw-r--r--app/helpers/intruders_helper.rb2
-rw-r--r--app/models/intruder.rb3
-rw-r--r--app/views/intruders/_form.html.haml7
-rw-r--r--app/views/intruders/_form_core.html.haml16
-rw-r--r--app/views/intruders/_index_core.html.haml37
-rw-r--r--app/views/intruders/edit.html.haml3
-rw-r--r--app/views/intruders/index.html.haml6
-rw-r--r--app/views/intruders/new.html.haml3
-rw-r--r--app/views/intruders/show.html.haml49
10 files changed, 167 insertions, 0 deletions
diff --git a/app/controllers/intruders_controller.rb b/app/controllers/intruders_controller.rb
new file mode 100644
index 0000000..eb34f2b
--- /dev/null
+++ b/app/controllers/intruders_controller.rb
@@ -0,0 +1,41 @@
+class IntrudersController < ApplicationController
+ def index
+ @intruders = Intruder.all
+ end
+
+ def show
+ @intruder = Intruder.find(params[:id])
+ end
+
+ def new
+ @intruder = Intruder.new
+ end
+
+ def create
+ @intruder = Intruder.new(params[:intruder])
+ if @intruder.save
+ redirect_to @intruder, :notice => t('intruders.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @intruder = Intruder.find(params[:id])
+ end
+
+ def update
+ @intruder = Intruder.find(params[:id])
+ if @intruder.update_attributes(params[:intruder])
+ redirect_to @intruder, :notice => t('intruders.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @intruder = Intruder.find(params[:id])
+ @intruder.destroy
+ redirect_to intruders_url, :notice => t('intruders.controller.successfuly_destroyed')
+ end
+end
diff --git a/app/helpers/intruders_helper.rb b/app/helpers/intruders_helper.rb
new file mode 100644
index 0000000..7243cf3
--- /dev/null
+++ b/app/helpers/intruders_helper.rb
@@ -0,0 +1,2 @@
+module IntrudersHelper
+end
diff --git a/app/models/intruder.rb b/app/models/intruder.rb
new file mode 100644
index 0000000..192d64d
--- /dev/null
+++ b/app/models/intruder.rb
@@ -0,0 +1,3 @@
+class Intruder < ActiveRecord::Base
+ attr_accessible :list_type, :key, :points, :bans, :ban_last, :ban_end, :contact_ip, :contact_port, :contact_count, :contact_last, :contacts_per_second, :contacts_per_second_max, :user_agent, :to_user, :comment
+end
diff --git a/app/views/intruders/_form.html.haml b/app/views/intruders/_form.html.haml
new file mode 100644
index 0000000..26aab1c
--- /dev/null
+++ b/app/views/intruders/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for(@intruder) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .actions
+ = f.button :submit, conditional_t('intruders.form.submit') \ No newline at end of file
diff --git a/app/views/intruders/_form_core.html.haml b/app/views/intruders/_form_core.html.haml
new file mode 100644
index 0000000..ae2da39
--- /dev/null
+++ b/app/views/intruders/_form_core.html.haml
@@ -0,0 +1,16 @@
+.inputs
+ = f.input :list_type, :label => t('intruders.form.list_type.label'), :hint => conditional_hint('intruders.form.list_type.hint')
+ = f.input :key, :label => t('intruders.form.key.label'), :hint => conditional_hint('intruders.form.key.hint')
+ = f.input :points, :label => t('intruders.form.points.label'), :hint => conditional_hint('intruders.form.points.hint')
+ = f.input :bans, :label => t('intruders.form.bans.label'), :hint => conditional_hint('intruders.form.bans.hint')
+ = f.input :ban_last, :label => t('intruders.form.ban_last.label'), :hint => conditional_hint('intruders.form.ban_last.hint')
+ = f.input :ban_end, :label => t('intruders.form.ban_end.label'), :hint => conditional_hint('intruders.form.ban_end.hint')
+ = f.input :contact_ip, :label => t('intruders.form.contact_ip.label'), :hint => conditional_hint('intruders.form.contact_ip.hint')
+ = f.input :contact_port, :label => t('intruders.form.contact_port.label'), :hint => conditional_hint('intruders.form.contact_port.hint')
+ = f.input :contact_count, :label => t('intruders.form.contact_count.label'), :hint => conditional_hint('intruders.form.contact_count.hint')
+ = f.input :contact_last, :label => t('intruders.form.contact_last.label'), :hint => conditional_hint('intruders.form.contact_last.hint')
+ = f.input :contacts_per_second, :label => t('intruders.form.contacts_per_second.label'), :hint => conditional_hint('intruders.form.contacts_per_second.hint')
+ = f.input :contacts_per_second_max, :label => t('intruders.form.contacts_per_second_max.label'), :hint => conditional_hint('intruders.form.contacts_per_second_max.hint')
+ = f.input :user_agent, :label => t('intruders.form.user_agent.label'), :hint => conditional_hint('intruders.form.user_agent.hint')
+ = f.input :to_user, :label => t('intruders.form.to_user.label'), :hint => conditional_hint('intruders.form.to_user.hint')
+ = f.input :comment, :label => t('intruders.form.comment.label'), :hint => conditional_hint('intruders.form.comment.hint')
diff --git a/app/views/intruders/_index_core.html.haml b/app/views/intruders/_index_core.html.haml
new file mode 100644
index 0000000..0070c4d
--- /dev/null
+++ b/app/views/intruders/_index_core.html.haml
@@ -0,0 +1,37 @@
+%table.table.table-striped
+ %tr
+ %th= t('intruders.index.list_type')
+ %th= t('intruders.index.key')
+ %th= t('intruders.index.points')
+ %th= t('intruders.index.bans')
+ %th= t('intruders.index.ban_last')
+ %th= t('intruders.index.ban_end')
+ %th= t('intruders.index.contact_ip')
+ %th= t('intruders.index.contact_port')
+ %th= t('intruders.index.contact_count')
+ %th= t('intruders.index.contact_last')
+ %th= t('intruders.index.contacts_per_second')
+ %th= t('intruders.index.contacts_per_second_max')
+ %th= t('intruders.index.user_agent')
+ %th= t('intruders.index.to_user')
+ %th= t('intruders.index.comment')
+
+
+ - for intruder in intruders
+ %tr
+ %td= intruder.list_type
+ %td= intruder.key
+ %td= intruder.points
+ %td= intruder.bans
+ %td= intruder.ban_last
+ %td= intruder.ban_end
+ %td= intruder.contact_ip
+ %td= intruder.contact_port
+ %td= intruder.contact_count
+ %td= intruder.contact_last
+ %td= intruder.contacts_per_second
+ %td= intruder.contacts_per_second_max
+ %td= intruder.user_agent
+ %td= intruder.to_user
+ %td= intruder.comment
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => intruder} \ No newline at end of file
diff --git a/app/views/intruders/edit.html.haml b/app/views/intruders/edit.html.haml
new file mode 100644
index 0000000..1b5a31b
--- /dev/null
+++ b/app/views/intruders/edit.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("intruders.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/intruders/index.html.haml b/app/views/intruders/index.html.haml
new file mode 100644
index 0000000..72b8882
--- /dev/null
+++ b/app/views/intruders/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("intruders.index.page_title")
+
+- if @intruders && @intruders.count > 0
+ = render "index_core", :intruders => @intruders
+
+= render :partial => 'shared/create_link', :locals => {:child_class => Intruder} \ No newline at end of file
diff --git a/app/views/intruders/new.html.haml b/app/views/intruders/new.html.haml
new file mode 100644
index 0000000..a24b55f
--- /dev/null
+++ b/app/views/intruders/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("intruders.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/intruders/show.html.haml b/app/views/intruders/show.html.haml
new file mode 100644
index 0000000..fa5f59b
--- /dev/null
+++ b/app/views/intruders/show.html.haml
@@ -0,0 +1,49 @@
+- content_for :title, t("intruders.show.page_title")
+
+%p
+ %strong= t('intruders.show.list_type') + ":"
+ = @intruder.list_type
+%p
+ %strong= t('intruders.show.key') + ":"
+ = @intruder.key
+%p
+ %strong= t('intruders.show.points') + ":"
+ = @intruder.points
+%p
+ %strong= t('intruders.show.bans') + ":"
+ = @intruder.bans
+%p
+ %strong= t('intruders.show.ban_last') + ":"
+ = @intruder.ban_last
+%p
+ %strong= t('intruders.show.ban_end') + ":"
+ = @intruder.ban_end
+%p
+ %strong= t('intruders.show.contact_ip') + ":"
+ = @intruder.contact_ip
+%p
+ %strong= t('intruders.show.contact_port') + ":"
+ = @intruder.contact_port
+%p
+ %strong= t('intruders.show.contact_count') + ":"
+ = @intruder.contact_count
+%p
+ %strong= t('intruders.show.contact_last') + ":"
+ = @intruder.contact_last
+%p
+ %strong= t('intruders.show.contacts_per_second') + ":"
+ = @intruder.contacts_per_second
+%p
+ %strong= t('intruders.show.contacts_per_second_max') + ":"
+ = @intruder.contacts_per_second_max
+%p
+ %strong= t('intruders.show.user_agent') + ":"
+ = @intruder.user_agent
+%p
+ %strong= t('intruders.show.to_user') + ":"
+ = @intruder.to_user
+%p
+ %strong= t('intruders.show.comment') + ":"
+ = @intruder.comment
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @intruder } \ No newline at end of file