_ctl [start|stop|restart]
12 |
13 | App-wide control script (I add this to my capistrano recipe's after_restart task):
14 | > ./script/daemons [start|stop|restart]
--------------------------------------------------------------------------------
/misc/migrate_forward_ports.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | Contract.all(:conditions => "forward_ports is not null and forward_ports != ''").each do |c|
4 | c.forward_ports.split(",").each do |port|
5 | in_port,out_port = port.split(":")
6 | out_port = in_port if out_port.blank?
7 | c.provider_group.providers.enabled.each do |p|
8 | c.forwarded_ports.create!( :provider => p, :public_port => in_port, :private_port => out_port, :tcp => true, :udp => true)
9 | puts "#{c.id} p #{p.id} public #{in_port} private #{out_port}"
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/app/views/avoid_balancing_hosts/edit.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for :title, t('actions.edit', :model => AvoidBalancingHost.human_name) %>
2 | <% heading t('actions.edit', :model => AvoidBalancingHost.human_name) %>
3 |
4 |
5 | - <%= link_to t('buttons.view_audit'), audits_path('search[auditable_type_is]' => 'AvoidBalancingHost', 'search[auditable_id_equals]' => @avoid_balancing_host.id) %>
6 | <%= render :partial => "shared/submenu_items"%>
7 |
8 |
9 |
10 | <%= render @avoid_balancing_host %>
11 |
12 |
13 |
--------------------------------------------------------------------------------
/db/migrate/20110721133221_add_iptables_tree_optimization_enabled_to_configuration.rb:
--------------------------------------------------------------------------------
1 | class AddIptablesTreeOptimizationEnabledToConfiguration < ActiveRecord::Migration
2 | def self.up
3 | #optimze only on known 64bits machines
4 | optimize = begin
5 | `uname -m`.chomp == 'x86_64' ? true : false
6 | rescue
7 | false
8 | end
9 | add_column :configurations, :iptables_tree_optimization_enabled, :boolean, :default => optimize
10 | end
11 |
12 | def self.down
13 | remove_column :configurations, :iptables_tree_optimization_enabled
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/db/migrate/20100802214909_add_transparent_proxy_to_contract.rb:
--------------------------------------------------------------------------------
1 | class AddTransparentProxyToContract < ActiveRecord::Migration
2 | def self.up
3 | add_column :contracts, :transparent_proxy, :boolean, :default => nil
4 | add_column :plans, :transparent_proxy, :boolean, :default => false
5 | add_column :configurations, :transparent_proxy, :boolean, :default => true
6 | end
7 |
8 | def self.down
9 | remove_column :contracts, :transparent_proxy
10 | remove_column :plans, :transparent_proxy
11 | remove_column :configurations, :transparent_proxy
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/db/migrate/20100823193812_change_transparent_proxy_to_string_in_contract.rb:
--------------------------------------------------------------------------------
1 | class ChangeTransparentProxyToStringInContract < ActiveRecord::Migration
2 | def self.up
3 | change_column :contracts, :transparent_proxy, :string, :default => "default"
4 | Contract.reset_column_information
5 | Contract.update_all( {:transparent_proxy => "default" } )
6 | end
7 |
8 | def self.down
9 | change_column :contracts, :transparent_proxy, :boolean, :default => nil
10 | Contract.reset_column_information
11 | Contract.update_all( {:transparent_proxy => nil } )
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/db/migrate/20091020162918_create_providers.rb:
--------------------------------------------------------------------------------
1 | class CreateProviders < ActiveRecord::Migration
2 | def self.up
3 | create_table :providers do |t|
4 | t.integer :provider_group_id
5 | t.integer :interface_id
6 | t.string :kind
7 | t.string :name
8 | t.string :ip
9 | t.string :netmask
10 | t.string :gateway
11 | t.integer :rate_down
12 | t.integer :rate_up
13 | t.string :pppoe_user
14 | t.string :pppoe_pass
15 |
16 | t.timestamps
17 | end
18 | end
19 |
20 | def self.down
21 | drop_table :providers
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/misc/translate_iptables_save.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | #
3 |
4 | IPTABLES_FILE="/tmp/sequreisp/scripts/iptables"
5 | OUTPUT_FILE="/tmp/iptables.sh"
6 | table=nil
7 | File.open(OUTPUT_FILE, "w") do |f|
8 | File.open(IPTABLES_FILE, "r").each do |line|
9 | if line.match /^\*(.*)$/
10 | table=$1
11 | f.puts "iptables -t #{table} -F"
12 | f.puts "iptables -t #{table} -X"
13 | elsif line.match /^-/
14 | f.puts "iptables -t #{table} #{line}"
15 | elsif line.match /^:([^ ]+) .*$/
16 | f.puts "iptables -t #{table} -N #{$1}"
17 | end
18 | end
19 | f.chmod 0755
20 | end
21 |
--------------------------------------------------------------------------------
/script/create_plugin_migration:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #Colors
4 | # text
5 | black='\e[0;30m'
6 | white='\e[0;37m'
7 | yellow='\e[0;33m'
8 | red='\e[00;31m'
9 | green='\e[00;32m'
10 | close_color='\e[00m'
11 |
12 | plugins=`ls vendor/plugins/ | grep 'sequreisp_'`
13 | current_directory=`pwd`
14 | for plugin in $plugins
15 | do
16 | cd vendor/plugins/$plugin
17 | branch=`git branch | awk '/\*/ { print $2; }'`
18 | echo -e "${red} script/generate plugin_migration $plugin${close_color} ${green}[${branch}]${close_color}"
19 | cd $current_directory
20 | script/generate plugin_migration $plugin 2> /dev/null
21 | done
22 |
--------------------------------------------------------------------------------
/db/migrate/20130527155403_create_traffic_accountings.rb:
--------------------------------------------------------------------------------
1 | class CreateTrafficAccountings < ActiveRecord::Migration
2 | def self.up
3 | create_table :traffics do |t|
4 | t.decimal :data_total, :default => 0, :precision => 20
5 | t.decimal :data_total_extra, :default => 0, :precision => 20
6 | t.decimal :data_count, :default => 0, :precision => 20
7 | t.date :from_date
8 | t.date :to_date
9 | t.integer :contract_id
10 | t.timestamps
11 | end
12 | add_index :traffics, :contract_id
13 | end
14 |
15 | def self.down
16 | drop_table :traffics
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/config/initializers/email.rb:
--------------------------------------------------------------------------------
1 | # Loads action_mailer settings from email.yml
2 | # and turns deliveries on if configuration file is found
3 |
4 | filename = File.join(File.dirname(__FILE__), '..', 'email.yml')
5 | if File.file?(filename)
6 | mailconfig = YAML::load_file(filename)
7 |
8 | if mailconfig.is_a?(Hash) && mailconfig.has_key?(Rails.env)
9 | # Enable deliveries
10 | ActionMailer::Base.perform_deliveries = true
11 |
12 | mailconfig[Rails.env].each do |k, v|
13 | v.symbolize_keys! if v.respond_to?(:symbolize_keys!)
14 | ActionMailer::Base.send("#{k}=", v)
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/public/stylesheets/form.css:
--------------------------------------------------------------------------------
1 | div.errorExplanation{
2 | background-color: #B6B6B6;
3 | margin: 5px 5px 15px 5px;
4 | padding: 7px;
5 | width: 50%;
6 | }
7 |
8 | div.errorExplanation h2{
9 | font-size: 17px;
10 | color: #900;
11 | margin-left: 7px;
12 | font-weight: bold;
13 | }
14 |
15 | div.errorExplanation p{
16 | margin-left: 7px;
17 | margin-bottom: 4px;
18 | font-weight: bold;
19 | }
20 |
21 | div.errorExplanation li{
22 | list-style: disc;
23 | }
24 |
25 | div.errorExplanation span.attribute_name{
26 | font-style: italic;
27 | font-weight: bold;
28 | color: #900;
29 | }
30 |
--------------------------------------------------------------------------------
/app/views/layouts/partials/_apply_changes_banner.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <% if current_user.may_doreload_configuration? and Configuration.first.changes_to_apply? %>
3 |
4 |
5 | <%= t('notifications.changes_to_be_applied_notice') %>
6 |
7 |
8 | <% link_to({:controller => "configurations", :action => "doreload"}, :class => "button") do %>
9 |
10 | <%= t('menu.apply_changes') %>
11 |
12 | <% end %>
13 |
14 |
15 | <% end %>
16 |
17 |
--------------------------------------------------------------------------------
/app/views/app_mailer/check_links_email.text.plain.erb:
--------------------------------------------------------------------------------
1 | Cambio de estado de los enlaces
2 |
3 | <% ProviderGroup.enabled.each do |pg| %>
4 | Grupo: <%= pg.name %>
5 | <%= sprintf "-----------------------------------------------------------" %>
6 | <%= sprintf "| %-20s | %10s | %19s |", "Proveedor", "Estado", "IP" %>
7 | <%= sprintf "-----------------------------------------------------------" %>
8 | <%- pg.providers.enabled.each do |p| -%>
9 | <%= sprintf "| %-20s | %10s | %19s |", p.name[0..19], p.online ? "online" : "offline", p.ip.blank? ? "-" : p.ip %>
10 | <% end -%>
11 | <%= sprintf "-----------------------------------------------------------" %>
12 | <% end -%>
13 |
--------------------------------------------------------------------------------
/app/views/shared/_address_fields.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <%= f.input :ip, :input_html => { :class => "input_address_ip" }, :wrapper_html => { :class => "left" } %>
3 | <%= f.input :netmask, :input_html => { :class => "input_address_ip" }, :wrapper_html => { :class => "left" } %>
4 | <%#FIXME should not be printed and hidden, the if f.object.addressable_type == 'Provider' approuch return nil on new :( %>
5 | <%= f.input :use_in_nat_pool, :input_html => { :class => "checkbox_address" }, :wrapper_html => { :class => "left use_in_nat_pool" } %>
6 | <%# end %>
7 |
<%= link_to_remove_fields t('buttons.delete'), f %>
8 |
9 |
--------------------------------------------------------------------------------
/vendor/plugins/engines/test/unit/testing_test.rb:
--------------------------------------------------------------------------------
1 | require File.dirname(__FILE__) + '/../test_helper'
2 |
3 | class TestingTest < Test::Unit::TestCase
4 | def setup
5 | Engines::Testing.set_fixture_path
6 | @filename = File.join(Engines::Testing.temporary_fixtures_directory, 'testing_fixtures.yml')
7 | File.delete(@filename) if File.exists?(@filename)
8 | end
9 |
10 | def teardown
11 | File.delete(@filename) if File.exists?(@filename)
12 | end
13 |
14 | def test_should_copy_fixtures_files_to_tmp_directory
15 | assert !File.exists?(@filename)
16 | Engines::Testing.setup_plugin_fixtures
17 | assert File.exists?(@filename)
18 | end
19 | end
--------------------------------------------------------------------------------
/db/migrate/20091020162512_create_contracts.rb:
--------------------------------------------------------------------------------
1 | class CreateContracts < ActiveRecord::Migration
2 | def self.up
3 | create_table :contracts do |t|
4 | t.integer :plan_id
5 | t.integer :client_id
6 | t.date :date_start
7 | t.string :ip
8 | t.string :mac_address
9 | t.string :public_ip
10 | t.integer :ceil_dfl_percent
11 | t.string :tcp_prio_ports
12 | t.string :udp_prio_ports
13 | t.string :prio_protos
14 | t.string :prio_helpers
15 | t.string :forward_ports
16 | t.string :state
17 |
18 | t.timestamps
19 | end
20 | end
21 |
22 | def self.down
23 | drop_table :contracts
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/script/fixes/2013-08-23-v3.4.8-destroy_traffic_duplicate_for_each_contract.rb:
--------------------------------------------------------------------------------
1 | Contract.all.each do |c|
2 | unless c.traffics.empty?
3 | init = c.traffics.first.from_date
4 | final = c.traffics.last.to_date
5 | while init <= final
6 | traffic = Traffic.first(:conditions => ["from_date = '#{init.strftime('%Y-%m-%d')}' and contract_id = #{c.id}"])
7 | unless traffic.nil?
8 | Traffic.delete_all(["to_date = '#{traffic.to_date.strftime('%Y-%m-%d')}' and from_date = '#{traffic.from_date.strftime('%Y-%m-%d')}' and contract_id = #{c.id} and id != #{traffic.id}"])
9 | end
10 | init = (init + 1.month).beginning_of_month
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/app/models/always_allowed_site.rb:
--------------------------------------------------------------------------------
1 | class AlwaysAllowedSite < ActiveRecord::Base
2 |
3 | acts_as_audited
4 |
5 | validates_presence_of :name
6 | validates_format_of :name, :with => /^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|\b-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|\b-){0,61}[0-9A-Za-z])?)*\.?$/
7 |
8 | include ModelsWatcher
9 | watch_fields :name
10 | watch_on_destroy
11 |
12 | def ip_addresses
13 | require 'resolv'
14 | begin
15 | Resolv.getaddresses(name).select do |a| IP.new(a).is_a?(IP::V4) end
16 | rescue
17 | []
18 | end
19 | end
20 |
21 | def auditable_name
22 | "#{self.class.human_name}: #{website}"
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/app/views/layouts/login.html.erb:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 | <%= render :partial => "layouts/partials/head" %>
8 |
9 |
10 |
11 | <%= render :partial => "layouts/partials/header" %>
12 |
13 | <%= yield %>
14 |
15 | <%= render :partial => "layouts/partials/footer" %>
16 |
17 |
18 |
--------------------------------------------------------------------------------
/db/migrate/20100603150440_add_queues_to_contract.rb:
--------------------------------------------------------------------------------
1 | class AddQueuesToContract < ActiveRecord::Migration
2 | def self.up
3 | add_column :contracts, :queue_down_prio, :float, :default => 0, :limit => 8
4 | add_column :contracts, :queue_up_prio, :float, :default => 0, :limit => 8
5 | add_column :contracts, :queue_down_dfl, :float, :default => 0, :limit => 8
6 | add_column :contracts, :queue_up_dfl, :float, :default => 0, :limit => 8
7 | end
8 |
9 | def self.down
10 | remove_column :contracts, :queue_up_dfl
11 | remove_column :contracts, :queue_down_dfl
12 | remove_column :contracts, :queue_up_prio
13 | remove_column :contracts, :queue_down_prio
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/db/migrate/20131025123752_add_web_interface_listen_on_ports_to_configuration.rb:
--------------------------------------------------------------------------------
1 | class AddWebInterfaceListenOnPortsToConfiguration < ActiveRecord::Migration
2 | def self.up
3 | add_column :configurations, :web_interface_listen_on_80, :boolean, :default => true
4 | add_column :configurations, :web_interface_listen_on_443, :boolean, :default => true
5 | add_column :configurations, :web_interface_listen_on_8080, :boolean, :default => true
6 | end
7 |
8 | def self.down
9 | remove_column :configurations, :web_interface_listen_on_8080
10 | remove_column :configurations, :web_interface_listen_on_443
11 | remove_column :configurations, :web_interface_listen_on_80
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/config/preinitializer.rb:
--------------------------------------------------------------------------------
1 | begin
2 | require "rubygems"
3 | require "bundler"
4 | rescue LoadError
5 | raise "Could not load the bundler gem. Install it with `gem install bundler`."
6 | end
7 |
8 | if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
9 | raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
10 | "Run `gem install bundler` to upgrade."
11 | end
12 |
13 | begin
14 | # Set up load paths for all bundled gems
15 | ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
16 | Bundler.setup
17 | rescue Bundler::GemNotFound
18 | raise RuntimeError, "Bundler couldn't find some gems." +
19 | "Did you run `bundle install`?"
20 | end
21 |
22 |
--------------------------------------------------------------------------------
/db/migrate/20140602164035_add_attrs_for_bind_dns_in_configuration.rb:
--------------------------------------------------------------------------------
1 | class AddAttrsForBindDnsInConfiguration < ActiveRecord::Migration
2 | def self.up
3 | add_column :configurations, :dns_use_forwarders, :boolean, :default => false
4 | add_column :configurations, :dns_first_server, :string
5 | add_column :configurations, :dns_second_server, :string
6 | add_column :configurations, :dns_third_server, :string
7 | end
8 |
9 | def self.down
10 | remove_column :configurations, :dns_use_forwarders
11 | remove_column :configurations, :dns_first_server
12 | remove_column :configurations, :dns_second_server
13 | remove_column :configurations, :dns_third_server
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/app/views/always_allowed_sites/_always_allowed_site.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <% semantic_form_for @always_allowed_site do |form| %>
3 | <%= error_messages @always_allowed_site %>
4 | <% form.inputs do %>
5 | <%= form.input :name, :wrapper_html => { :class => "left" } %>
6 | <%= form.input :detail, :wrapper_html => { :class => "left" } %>
7 |
8 | <%= form_extensions form %>
9 | <% end %>
10 | <% if current_user.may_create_always_allowed_site? %>
11 | <% form.buttons do %>
12 | <%= form.commit_button @commit_text, :button_html => {:disable_with => t('buttons.please_wait')} %>
13 | <% end %>
14 | <% end %>
15 | <% end %>
16 |
--------------------------------------------------------------------------------
/app/models/avoid_balancing_host.rb:
--------------------------------------------------------------------------------
1 | class AvoidBalancingHost < ActiveRecord::Base
2 | belongs_to :provider
3 | acts_as_audited
4 | validates_presence_of :name, :provider
5 | validates_format_of :name, :with => /^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|\b-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|\b-){0,61}[0-9A-Za-z])?)*\.?$/
6 |
7 | include ModelsWatcher
8 | watch_fields :name, :provider_id
9 | watch_on_destroy
10 |
11 | def ip_addresses
12 | require 'resolv'
13 | begin
14 | Resolv.getaddresses(name).select do |a| IP.new(a).is_a?(IP::V4) end
15 | rescue
16 | []
17 | end
18 | end
19 |
20 | def auditable_name
21 | "#{self.class.human_name}: #{name}"
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/db/migrate/20100224150104_create_configurations.rb:
--------------------------------------------------------------------------------
1 | class CreateConfigurations < ActiveRecord::Migration
2 | def self.up
3 | create_table :configurations do |t|
4 | t.string :name
5 | t.string :default_tcp_prio_ports
6 | t.string :default_udp_prio_ports
7 | t.string :default_prio_protos
8 | t.string :default_prio_helpers
9 | t.string :default_ceil_dfl_percent
10 | t.string :rate_dfl_percent
11 | t.integer :mtu
12 | t.integer :r2q
13 | t.integer :class_start
14 | t.integer :rate_granted
15 | t.string :quantum_factor
16 | t.boolean :active
17 |
18 | t.timestamps
19 | end
20 | end
21 |
22 | def self.down
23 | drop_table :configurations
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/db/migrate/20100604134403_add_consumptions_to_contract.rb:
--------------------------------------------------------------------------------
1 | class AddConsumptionsToContract < ActiveRecord::Migration
2 | def self.up
3 | add_column :contracts, :consumption_down_prio, 'bigint unsigned', :default => 0
4 | add_column :contracts, :consumption_up_prio, 'bigint unsigned', :default => 0
5 | add_column :contracts, :consumption_down_dfl, 'bigint unsigned', :default => 0
6 | add_column :contracts, :consumption_up_dfl, 'bigint unsigned', :default => 0
7 | end
8 |
9 | def self.down
10 | remove_column :contracts, :consumption_up_dfl
11 | remove_column :contracts, :consumption_down_dfl
12 | remove_column :contracts, :consumption_up_prio
13 | remove_column :contracts, :consumption_down_prio
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/db/migrate/20100608140705_add_consumptions_to_provider.rb:
--------------------------------------------------------------------------------
1 | class AddConsumptionsToProvider < ActiveRecord::Migration
2 | def self.up
3 | add_column :providers, :consumption_down_prio, 'bigint unsigned', :default => 0
4 | add_column :providers, :consumption_up_prio, 'bigint unsigned', :default => 0
5 | add_column :providers, :consumption_down_dfl, 'bigint unsigned', :default => 0
6 | add_column :providers, :consumption_up_dfl, 'bigint unsigned', :default => 0
7 | end
8 |
9 | def self.down
10 | remove_column :providers, :consumption_up_dfl
11 | remove_column :providers, :consumption_down_dfl
12 | remove_column :providers, :consumption_up_prio
13 | remove_column :providers, :consumption_down_prio
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/vendor/plugins/engines/test/app/models/notify_mail.rb:
--------------------------------------------------------------------------------
1 | class NotifyMail < ActionMailer::Base
2 |
3 | helper :mail
4 |
5 | def signup(txt)
6 | body(:name => txt)
7 | end
8 |
9 | def multipart
10 | recipients 'some_address@email.com'
11 | subject 'multi part email'
12 | from "another_user@email.com"
13 | content_type 'multipart/alternative'
14 |
15 | part :content_type => "text/html", :body => render_message("multipart_html", {})
16 | part "text/plain" do |p|
17 | p.body = render_message("multipart_plain", {})
18 | end
19 | end
20 |
21 | def implicit_multipart
22 | recipients 'some_address@email.com'
23 | subject 'multi part email'
24 | from "another_user@email.com"
25 | end
26 | end
--------------------------------------------------------------------------------
/lib/generators/sequreisp_plugin/templates/layout.rb:
--------------------------------------------------------------------------------
1 | <% content_for :sequreisp_plugin_menu do %>
2 | <% content_for :plugin_name, t("plugin.name") %>
3 | <% content_for :plugin_menu do %>
4 |
18 | <% end %>
19 | <%= render :partial => 'layouts/partials/plugin_submenu' %>
20 | <% end %>
21 | <%= render :file => 'layouts/application' %>
22 |
--------------------------------------------------------------------------------
/public/stylesheets/reset.css:
--------------------------------------------------------------------------------
1 | *, html, body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, p, blockquote, label, table, th, tr, td, embed, object {
2 | margin: 0 0 0 0;
3 | padding: 0 0 0 0;
4 | }
5 |
6 | table {
7 | border-collapse: collapse;
8 | border-spacing: 0;
9 | }
10 |
11 | fieldset, img, a img, a:link img, a:visited img {
12 | border: 0;
13 | }
14 |
15 | address ,caption, cite, code, dfn, th, var {
16 | font-style: normal;
17 | font-weight: normal;
18 | }
19 |
20 | ol, ul {
21 | list-style: none;
22 | }
23 |
24 | caption, th {
25 | text-align: left;
26 | }
27 |
28 | h1, h2, h3, h4, h5, h6 {
29 | font-size: 100%;
30 | }
31 |
32 | q:before,
33 | q:after {
34 | content: '';
35 | }
36 |
37 | embed, object {
38 | display: block;
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/db/migrate/20100607222517_add_consumptions_to_provider_group.rb:
--------------------------------------------------------------------------------
1 | class AddConsumptionsToProviderGroup < ActiveRecord::Migration
2 | def self.up
3 | add_column :provider_groups, :consumption_down_prio, 'bigint unsigned', :default => 0
4 | add_column :provider_groups, :consumption_up_prio, 'bigint unsigned', :default => 0
5 | add_column :provider_groups, :consumption_down_dfl, 'bigint unsigned', :default => 0
6 | add_column :provider_groups, :consumption_up_dfl, 'bigint unsigned', :default => 0
7 | end
8 |
9 | def self.down
10 | remove_column :provider_groups, :consumption_up_dfl
11 | remove_column :provider_groups, :consumption_down_dfl
12 | remove_column :provider_groups, :consumption_up_prio
13 | remove_column :provider_groups, :consumption_down_prio
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/vendor/plugins/engines/boot.rb:
--------------------------------------------------------------------------------
1 | begin
2 | require 'rails/version'
3 | unless Rails::VERSION::MAJOR >= 2 && Rails::VERSION::MINOR >= 3 && Rails::VERSION::TINY >= 2
4 | raise "This version of the engines plugin requires Rails 2.3.2 or later!"
5 | end
6 | end
7 |
8 | require File.join(File.dirname(__FILE__), 'lib/engines')
9 |
10 | # initialize Rails::Configuration with our own default values to spare users
11 | # some hassle with the installation and keep the environment cleaner
12 |
13 | { :default_plugin_locators => (defined?(Gem) ? [Rails::Plugin::GemLocator] : []).push(Engines::Plugin::FileSystemLocator),
14 | :default_plugin_loader => Engines::Plugin::Loader,
15 | :default_plugins => [:engines, :all] }.each do |name, default|
16 | Rails::Configuration.send(:define_method, name) { default }
17 | end
--------------------------------------------------------------------------------
/lib/tasks/common.rake:
--------------------------------------------------------------------------------
1 | namespace :db do
2 | desc 'Run migrations from start'
3 | task :remigrate => :environment do
4 | ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.drop_table t }
5 | # Migrate upward
6 | Rake::Task["db:migrate"].invoke
7 | # Dump the schema
8 | Rake::Task["db:schema:dump"].invoke
9 | end
10 |
11 | desc 'Remigrate and seed'
12 | task :reseed => [:remigrate, :seed]
13 |
14 | desc 'Remigrate and seed'
15 | task :repopulate => [:remigrate, :seed, 'populate:all']
16 |
17 | desc 'Same as script/runner misc/simulate-rrd.rb'
18 | task :simulate => :environment do
19 | eval(File.open('misc/simulate-rrd.rb', 'r').read)
20 | end
21 |
22 | desc 'Reset, populate and simulate'
23 | task :resimulate => [:reset, 'populate:all', :simulate]
24 | end
25 |
--------------------------------------------------------------------------------
/db/migrate/20101213125305_add_audits_table.rb:
--------------------------------------------------------------------------------
1 | class AddAuditsTable < ActiveRecord::Migration
2 | def self.up
3 | create_table :audits, :force => true do |t|
4 | t.column :auditable_id, :integer
5 | t.column :auditable_type, :string
6 | t.column :user_id, :integer
7 | t.column :user_type, :string
8 | t.column :username, :string
9 | t.column :action, :string
10 | t.column :changes, :text
11 | t.column :version, :integer, :default => 0
12 | t.column :created_at, :datetime
13 | end
14 |
15 | add_index :audits, [:auditable_id, :auditable_type], :name => 'auditable_index'
16 | add_index :audits, [:user_id, :user_type], :name => 'user_index'
17 | add_index :audits, :created_at
18 | end
19 |
20 | def self.down
21 | drop_table :audits
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/app/helpers/plans_helper.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | module PlansHelper
19 | end
20 |
--------------------------------------------------------------------------------
/app/helpers/users_helper.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | module UsersHelper
19 | end
20 |
--------------------------------------------------------------------------------
/app/views/clients/edit.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for :title, t('actions.edit', :model => Client.human_name) %>
2 | <% heading t('actions.edit', :model => Client.human_name)%>
3 |
4 |
5 | <% if current_user.may_create_contract? %>
6 | - <%= link_to t('buttons.create_contract'), new_client_contract_path(@client) %>
7 | <% end %>
8 | <% if current_user.may_index_contracts? %>
9 | - <%= link_to t('buttons.view_contracts'), contracts_path("search" => {"client_id_equals"=> @client.id }) %>
10 | <% end %>
11 | - <%= link_to t('buttons.view_audit'), audits_path('search[auditable_type_is]' => 'Client', 'search[auditable_id_equals]' => @client.id) %>
12 | <%= render :partial => "shared/submenu_items"%>
13 |
14 |
15 |
16 | <%= render @client %>
17 |
18 |
--------------------------------------------------------------------------------
/app/helpers/backup_helper.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | module BackupHelper
19 | end
20 |
--------------------------------------------------------------------------------
/app/helpers/clients_helper.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | module ClientsHelper
19 | end
20 |
--------------------------------------------------------------------------------
/app/helpers/interfaces_helper.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | module InterfacesHelper
19 | end
20 |
--------------------------------------------------------------------------------
/app/helpers/user_sessions_helper.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | module UserSessionsHelper
19 | end
20 |
--------------------------------------------------------------------------------
/vendor/plugins/daemon_generator/generators/daemon/templates/script_ctl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'rubygems'
3 | require "daemons"
4 | require 'yaml'
5 | require 'erb'
6 |
7 | file_name = File.dirname(__FILE__) + "/../../vendor/rails/activesupport/lib/active_support.rb"
8 |
9 | if(File.exists?(file_name))
10 | require file_name
11 | else
12 | rails_version = File.new(File.dirname(__FILE__)+ "/../../config/environment.rb").read.scan(/^ *RAILS_GEM_VERSION.*=.*['|"](.*)['|"]/)[0].to_s
13 |
14 | gem 'activesupport', rails_version
15 | require 'active_support'
16 | end
17 |
18 | options = YAML.load(
19 | ERB.new(
20 | IO.read(
21 | File.dirname(__FILE__) + "/../../config/daemons.yml"
22 | )).result).with_indifferent_access
23 | options[:dir_mode] = options[:dir_mode].to_sym
24 |
25 | Daemons.run File.dirname(__FILE__) + '/<%=file_name%>.rb', options
26 |
--------------------------------------------------------------------------------
/lib/boot_hook.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | module BootHook
19 |
20 | def self.run options
21 | end
22 |
23 | end
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | # Settings specified here will take precedence over those in config/environment.rb
2 |
3 | # In the development environment your application's code is reloaded on
4 | # every request. This slows down response time but is perfect for development
5 | # since you don't have to restart the webserver when you make code changes.
6 | config.cache_classes = false
7 |
8 | # Log error messages when you accidentally call methods on nil.
9 | config.whiny_nils = true
10 |
11 | # Show full error reports and disable caching
12 | config.action_controller.consider_all_requests_local = true
13 | config.action_view.debug_rjs = true
14 | config.action_controller.perform_caching = false
15 |
16 | # Don't care if the mailer can't send
17 | config.action_mailer.raise_delivery_errors = true
18 |
19 | config.reload_plugins = true
20 |
21 |
--------------------------------------------------------------------------------
/config/initializers/new_rails_defaults.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # These settings change the behavior of Rails 2 apps and will be defaults
4 | # for Rails 3. You can remove this initializer when Rails 3 is released.
5 |
6 | if defined?(ActiveRecord)
7 | # Include Active Record class name as root for JSON serialized output.
8 | ActiveRecord::Base.include_root_in_json = true
9 |
10 | # Store the full class name (including module namespace) in STI type column.
11 | ActiveRecord::Base.store_full_sti_class = true
12 | end
13 |
14 | # Use ISO 8601 format for JSON serialized times and dates.
15 | ActiveSupport.use_standard_json_time_format = true
16 |
17 | # Don't escape HTML entities in JSON, leave that for the #json_escape helper.
18 | # if you're including raw json in an HTML page.
19 | ActiveSupport.escape_html_entities_in_json = false
--------------------------------------------------------------------------------
/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Your secret key for verifying cookie session data integrity.
4 | # If you change this key, all old sessions will become invalid!
5 | # Make sure the secret is at least 30 characters and all random,
6 | # no regular words or you'll be exposed to dictionary attacks.
7 | ActionController::Base.session = {
8 | :key => '_sequreisp_session',
9 | :secret => '1c4bf270642d3f6619185181bbe54e7d53ff2c5af6d11332e11a6dc13edf223e5785df7f86fbdca74d7d871f3c2702dd08d59d34afe835b72abfa0d9c14847f5'
10 | }
11 |
12 | # Use the database for sessions instead of the cookie-based default,
13 | # which shouldn't be used to store highly confidential information
14 | # (create the session table with "rake db:sessions:create")
15 | # ActionController::Base.session_store = :active_record_store
16 |
--------------------------------------------------------------------------------
/app/models/provider_klass.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | class ProviderKlass < ActiveRecord::Base
19 | belongs_to :klassable, :polymorphic => true
20 | end
21 |
--------------------------------------------------------------------------------
/vendor/plugins/engines/test/functional/exception_notification_compatibility_test.rb:
--------------------------------------------------------------------------------
1 | require File.dirname(__FILE__) + '/../test_helper'
2 |
3 | class ExceptionNotificationCompatibilityTest < ActionController::TestCase
4 | ExceptionNotifier.exception_recipients = %w(joe@schmoe.com bill@schmoe.com)
5 | class SimpleController < ApplicationController
6 | include ExceptionNotifiable
7 | local_addresses.clear
8 | consider_all_requests_local = false
9 | def index
10 | begin
11 | raise "Fail!"
12 | rescue Exception => e
13 | rescue_action_in_public(e)
14 | end
15 | end
16 | end
17 |
18 | def setup
19 | @controller = SimpleController.new
20 | @request = ActionController::TestRequest.new
21 | @response = ActionController::TestResponse.new
22 | end
23 |
24 | def test_should_work
25 | assert_nothing_raised do
26 | get :index
27 | end
28 | end
29 | end
--------------------------------------------------------------------------------
/lib/daemon_hook.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | module DaemonHook
19 |
20 | def self.run options
21 | end
22 |
23 | def self.data_counting options
24 | end
25 |
26 | end
27 |
--------------------------------------------------------------------------------
/lib/sequre_mailer.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | class SequreMailer < ActionMailer::Base
19 | def set_language
20 | I18n.locale = Configuration.language
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/app/models/user_session.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | class UserSession < Authlogic::Session::Base
19 | logout_on_timeout true
20 | consecutive_failed_logins_limit 35
21 | end
22 |
--------------------------------------------------------------------------------
/app/models/language.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | class Language
19 | def self.languages_for_select
20 | [["English", "en"], ["Español", "es"], ["Português", "pt"]]
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/app/views/users/_user.html.erb:
--------------------------------------------------------------------------------
1 | <% unless current_user.may_update_user?(@user) %>
2 |
7 | <% end %>
8 |
9 | <% semantic_form_for @user do |form| %>
10 | <%= error_messages @user %>
11 | <% form.inputs do %>
12 | <%= form.input :name %>
13 | <%= form.input :email %>
14 | <%= form.input :role_name, :as => :select, :collection => User.roles_for_select, :include_blank => false %>
15 | <%= form.input :password %>
16 | <%= form.input :password_confirmation %>
17 | <%= form_extensions form%>
18 | <% end %>
19 | <% if current_user.may_update_user?(@user) or current_user.may_create_user? %>
20 | <% form.buttons do %>
21 | <%= if @commit_text.nil? then form.commit_button else form.commit_button @commit_text end %>
22 | <% end %>
23 | <% end %>
24 | <% end %>
25 |
26 |
--------------------------------------------------------------------------------
/app/views/provider_groups/_provider_group.html.erb:
--------------------------------------------------------------------------------
1 | <% unless current_user.may_update_provider_group?(@provider_group) %>
2 |
7 | <% end %>
8 |
9 | <% semantic_form_for @provider_group do |form| %>
10 | <%= error_messages @provider_group %>
11 | <% form.inputs do %>
12 | <%= form.input :name, :wrapper_html => { :class => "left" } %>
13 | <%= form.input :state, :as => :select, :collection => Provider.aasm_states_for_select, :include_blank => false %>
14 | <%= form_extensions form%>
15 | <% end %>
16 | <% if current_user.may_update_provider_group?(@provider_group) or current_user.may_create_provider_group? %>
17 | <% form.buttons do %>
18 | <%= if @commit_text.nil? then form.commit_button else form.commit_button @commit_text end %>
19 | <% end %>
20 | <% end %>
21 | <% end %>
22 |
23 |
--------------------------------------------------------------------------------
/public/javascripts/jquery.jtruncate.pack.js:
--------------------------------------------------------------------------------
1 | (function($){$.fn.jTruncate=function(h){var i={length:300,minTrail:20,moreText:"more",lessText:"less",ellipsisText:"...",moreAni:"",lessAni:""};var h=$.extend(i,h);return this.each(function(){obj=$(this);var a=obj.html();if(a.length>h.length+h.minTrail){var b=a.indexOf(' ',h.length);if(b!=-1){var b=a.indexOf(' ',h.length);var c=a.substring(0,b);var d=a.substring(b,a.length-1);obj.html(c+''+h.ellipsisText+''+''+d+'');obj.find('.truncate_more').css("display","none");obj.append('');var e=$('.truncate_more_link',obj);var f=$('.truncate_more',obj);var g=$('.truncate_ellipsis',obj);e.click(function(){if(e.text()==h.moreText){f.show(h.moreAni);e.text(h.lessText);g.css("display","none")}else{f.hide(h.lessAni);e.text(h.moreText);g.css("display","inline")}return false})}}})}})(jQuery);
--------------------------------------------------------------------------------
/app/views/layouts/partials/_plugin_submenu.html.erb:
--------------------------------------------------------------------------------
1 |
35 |
38 |
39 |
40 |
43 |
44 |
--------------------------------------------------------------------------------
/db/migrate/20100805191958_remove_and_add_items_to_confgiuration.rb:
--------------------------------------------------------------------------------
1 | class RemoveAndAddItemsToConfgiuration < ActiveRecord::Migration
2 | def self.up
3 | add_column :configurations, :nf_conntrack_max, :integer
4 | add_column :configurations, :gc_thresh1, :integer
5 | add_column :configurations, :gc_thresh2, :integer
6 | add_column :configurations, :gc_thresh3, :integer
7 | remove_column :configurations, :rate_dfl_percent
8 | remove_column :configurations, :class_start
9 | remove_column :configurations, :rate_granted
10 | end
11 |
12 | def self.down
13 | remove_column :configurations, :nf_conntrack_max
14 | remove_column :configurations, :gc_thresh1
15 | remove_column :configurations, :gc_thresh2
16 | remove_column :configurations, :gc_thresh3
17 | add_column :configurations, :rate_dfl_percent, :string
18 | add_column :configurations, :class_start, :integer
19 | add_column :configurations, :rate_granted, :integer
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/app/views/contracts/_forwarded_port_fields.html.erb:
--------------------------------------------------------------------------------
1 |
12 |
13 | <%= f.input :provider, :wrapper_html => { :class => "left" }, :input_html => { :class => "provider" } %>
14 | <%= f.input :public_port, :wrapper_html => { :class => "left" }, :input_html => { :class => "port" } %>
15 | <%= f.input :private_port, :wrapper_html => { :class => "left" }, :input_html => { :class => "port" } %>
16 | <%= f.input :tcp, :wrapper_html => { :class => "left down" } %>
17 | <%= f.input :udp, :wrapper_html => { :class => "left down" } %>
18 |
<%= link_to_remove_fields t('buttons.delete'), f %>
19 |
20 |
21 | <%= f.object.errors.on_base %>
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/controllers/abouts_controller.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | class AboutsController < ApplicationController
19 | before_filter :require_user
20 | permissions :about
21 | def show
22 | require 'sequreisp_about'
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/models/plugin_mail.rb:
--------------------------------------------------------------------------------
1 | class PluginMail < ActionMailer::Base
2 | def mail_from_plugin(note=nil)
3 | body(:note => note)
4 | end
5 |
6 | def mail_from_plugin_with_application_template(note=nil)
7 | body(:note => note)
8 | end
9 |
10 | def multipart_from_plugin
11 | content_type 'multipart/alternative'
12 | part :content_type => "text/html", :body => render_message("multipart_from_plugin_html", {})
13 | part "text/plain" do |p|
14 | p.body = render_message("multipart_from_plugin_plain", {})
15 | end
16 | end
17 |
18 | def multipart_from_plugin_with_application_template
19 | content_type 'multipart/alternative'
20 | part :content_type => "text/html", :body => render_message("multipart_from_plugin_with_application_template_html", {})
21 | part "text/plain" do |p|
22 | p.body = render_message("multipart_from_plugin_with_application_template_plain", {})
23 | end
24 | end
25 |
26 | end
--------------------------------------------------------------------------------
/app/helpers/configurations_helper.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | module ConfigurationsHelper
19 |
20 | def options_for_mail_relay
21 | [[t("messages.configuration.own"), "own"], [t("messages.configuration.gmail"), "gmail"]]
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/config/locales/es.authlogic.yml:
--------------------------------------------------------------------------------
1 | es:
2 | authlogic:
3 | error_messages:
4 | login_blank: no puede estar en blanco
5 | login_not_found: no es válido
6 | login_invalid: debe utilizar sólo letras, números, espacios y .-_@
7 | consecutive_failed_logins_limit_exceeded: El número de accesos no autorizados se ha superado, la cuenta ha sido desactivada por 2 horas.
8 | email_invalid: no es una dirección de e-mail válida.
9 | password_blank: no puede estar en blanco
10 | password_invalid: no es válido
11 | not_active: Su cuenta está desactivada.
12 | not_confirmed: Su cuenta no está confirmada.
13 | not_approved: Su cuenta no ha sido aprobada.
14 | no_authentication_details: Debe introducir sus datos de identificación.
15 | models:
16 | user_session: Sesión de usuario
17 | attributes:
18 | user_session:
19 | login: nombre de usuario
20 | email: e-mail
21 | password: contraseña
22 | remember_me: Recordarme
23 |
--------------------------------------------------------------------------------
/config/locales/pt.authlogic.yml:
--------------------------------------------------------------------------------
1 | pt:
2 | authlogic:
3 | error_messages:
4 | login_blank: não pode estar em blanco
5 | login_not_found: não é válido
6 | login_invalid: deve utilizar só letras, números, espacios e .-_@
7 | consecutive_failed_logins_limit_exceeded: O número de acessos ãno autorizados tem sido ultrapassado, a conta tem sido desativada por duas horas.
8 | email_invalid: não é um endereço de de e-mail válido.
9 | password_blank: não pode estar em blanco
10 | password_invalid: não é válido
11 | not_active: Sau conta está desativada.
12 | not_confirmed: Sua conta não está confirmada.
13 | not_approved: Sua conta não tem sido aprovada.
14 | no_authentication_details: Deve ingressar seus dados de identificação.
15 | models:
16 | user_session: Sessão de usuário
17 | attributes:
18 | user_session:
19 | login: nome de usuário
20 | email: e-mail
21 | password: senha
22 | remember_me: Lembrar-me
23 |
--------------------------------------------------------------------------------
/vendor/plugins/engines/test/functional/locale_loading_test.rb:
--------------------------------------------------------------------------------
1 | # Tests in this file ensure that:
2 | #
3 | # * translations in the application take precedence over those in plugins
4 | # * translations in subsequently loaded plugins take precendence over those in previously loaded plugins
5 |
6 | require File.dirname(__FILE__) + '/../test_helper'
7 |
8 | class LocaleLoadingTest < ActionController::TestCase
9 | def setup
10 | @request = ActionController::TestRequest.new
11 | @response = ActionController::TestResponse.new
12 | end
13 |
14 | # app takes precedence over plugins
15 |
16 | def test_WITH_a_translation_defined_in_both_app_and_plugin_IT_should_find_the_one_in_app
17 | assert_equal I18n.t('hello'), 'Hello world'
18 | end
19 |
20 | # subsequently loaded plugins take precendence over previously loaded plugins
21 |
22 | def test_WITH_a_translation_defined_in_two_plugins_IT_should_find_the_latter_of_both
23 | assert_equal I18n.t('plugin'), 'beta'
24 | end
25 | end
26 |
27 |
--------------------------------------------------------------------------------
/app/views/interfaces/graph.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for :javascript do %>
2 | <%= javascript_include_tag "highcharts" %>
3 | <%= javascript_include_tag "sequreispcharts" %>
4 | <% end %>
5 |
20 |
21 | <% heading t('graph.heading', :name => @graph.name) %>
22 |
23 |
24 |
<%=t 'graph.instant' %>
25 |
26 |
27 |
28 |
29 | <%= render :partial => 'shared/graph_history' %>
30 |
31 |
--------------------------------------------------------------------------------
/app/helpers/provider_groups_helper.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | module ProviderGroupsHelper
19 | def pretty_currency_index(ci)
20 | color = ci > 20 ? "#00cc00" : "#ff0000"
21 | "#{ci}"
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/db/migrate/20101124201859_add_general_indexes.rb:
--------------------------------------------------------------------------------
1 | class AddGeneralIndexes < ActiveRecord::Migration
2 | def self.up
3 | add_index :clients, :name
4 | add_index :contracts, :plan_id
5 | add_index :contracts, :client_id
6 | add_index :contracts, :ip
7 | add_index :forwarded_ports, :contract_id
8 | add_index :klasses, :contract_id
9 | add_index :klasses, :number
10 | add_index :provider_klasses, :klassable_id
11 | add_index :providers, :interface_id
12 | add_index :addresses, :addressable_id
13 | end
14 |
15 | def self.down
16 | remove_index :clients, :name
17 | remove_index :contracts, :plan_id
18 | remove_index :contracts, :client_id
19 | remove_index :contracts, :ip
20 | remove_index :forwarded_ports, :contract_id
21 | remove_index :klasses, :contract_id
22 | remove_index :klasses, :number
23 | remove_index :provider_klasses, :klassable_id
24 | remove_index :providers, :interface_id
25 | remove_index :addresses, :addressable_id
26 | end
27 | end
28 |
--------------------------------------------------------------------------------
/app/models/klass.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | class Klass < ActiveRecord::Base
19 | belongs_to :contract
20 |
21 | def prio1
22 | self.number + 1
23 | end
24 | def prio2
25 | self.number + 2
26 | end
27 | def prio3
28 | self.number + 3
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/app/views/iproutes/_iproute.html.erb:
--------------------------------------------------------------------------------
1 | <% unless current_user.may_update_iproute?(@iproute) %>
2 |
7 | <% end %>
8 |
9 | <% semantic_form_for @iproute do |form| %>
10 | <%= error_messages @iproute %>
11 | <% form.inputs do %>
12 | <%= form.input :dst_address, :wrapper_html => { :class => "left" } %>
13 | <%= form.input :gateway, :wrapper_html => { :class => "left" } %>
14 | <%= form.input :interface, :wrapper_html => { :class => "left" } %>
15 | <%= form.input :detail, :wrapper_html => { :class => "left" } %>
16 |
17 | <%= form_extensions form %>
18 | <% end %>
19 | <% if current_user.may_update_iproute?(@iproute) or current_user.may_create_iproute? %>
20 | <% form.buttons do %>
21 | <%= if @commit_text.nil? then form.commit_button else form.commit_button @commit_text end %>
22 | <% end %>
23 | <% end %>
24 | <% end %>
25 |
26 |
--------------------------------------------------------------------------------
/app/models/queued_command.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | class QueuedCommand < ActiveRecord::Base
19 | named_scope :pending, :conditions => { :executed => false }
20 | def initialize(attributes = nil)
21 | super(attributes)
22 | self.command = "" if self.command.nil?
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/bin/sequreisp_rrd_feed.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
4 | #
5 | # This file is part of Sequreisp.
6 | #
7 | # Sequreisp is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Afero General Public License as published by
9 | # the Free Software Foundation, either version 3 of the License, or
10 | # (at your option) any later version.
11 | #
12 | # Sequreisp is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Afero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Afero General Public License
18 | # along with Sequreisp. If not, see .
19 |
20 | #avoid run multiple instaneces of feeder
21 | #set -x
22 | script="sequreisp_rrd_feed.rb"
23 | count=$(pgrep -c -f $script)
24 | if [ $count -eq 0 ]; then
25 | ../script/runner -e production $script 2>/dev/null
26 | fi
27 |
--------------------------------------------------------------------------------
/public/422.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 | The change you wanted was rejected (422)
9 |
21 |
22 |
23 |
24 |
25 |
26 |
The change you wanted was rejected.
27 |
Maybe you tried to change something you didn't have access to.
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/helpers/providers_helper.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | module ProvidersHelper
19 | # this display_name is hookeable with alias_method_chain, should check plugins if changed
20 | def display_name(provider)
21 | h "#{provider.name} (#{t('selects.provider.kind.' + provider.kind)})"
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 | The page you were looking for doesn't exist (404)
9 |
21 |
22 |
23 |
24 |
25 |
26 |
The page you were looking for doesn't exist.
27 |
You may have mistyped the address or the page may have moved.
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/views/avoid_balancing_hosts/_avoid_balancing_host.html.erb:
--------------------------------------------------------------------------------
1 | <% unless current_user.may_update_avoid_balancing_host?(@avoid_balancing_host) %>
2 |
7 | <% end %>
8 |
9 | <% semantic_form_for @avoid_balancing_host do |form| %>
10 | <%= error_messages @avoid_balancing_host %>
11 | <% form.inputs do %>
12 | <%= form.input :name, :wrapper_html => { :class => "left" } %>
13 | <%= form.input :provider, :wrapper_html => { :class => "left" } %>
14 | <%= form.input :detail, :wrapper_html => { :class => "left" } %>
15 |
16 | <%= form_extensions form %>
17 | <% end %>
18 | <% if current_user.may_update_avoid_balancing_host?(@avoid_balancing_host) or current_user.may_create_avoid_balancing_host? %>
19 | <% form.buttons do %>
20 | <%= if @commit_text.nil? then form.commit_button else form.commit_button @commit_text end %>
21 | <% end %>
22 | <% end %>
23 | <% end %>
24 |
25 |
--------------------------------------------------------------------------------
/app/models/prohibited_forward_port.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | class ProhibitedForwardPort < ActiveRecord::Base
19 | before_save :set_tcp_by_default
20 |
21 | validates_presence_of :port
22 |
23 | def set_tcp_by_default
24 | if !self.tcp and !self.udp
25 | self.tcp = true
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/lib/prios_check.rb:
--------------------------------------------------------------------------------
1 | module PriosCheck
2 | FILE_SERVICES = RAILS_ROOT + "/db/files/valid_services"
3 | FILE_PROTOCOLS = RAILS_ROOT + "/db/files/valid_protocols"
4 | FILE_HELPERS = RAILS_ROOT + "/db/files/valid_helpers"
5 | def validate_in_range_or_in_file(attr, min, max, type)
6 | if self[attr].present?
7 | file = case type
8 | when :service
9 | FILE_SERVICES
10 | when :protocol
11 | FILE_PROTOCOLS
12 | when :helper
13 | FILE_HELPERS
14 | end
15 | valid_services= IO.readlines(file).collect{ |i| i.chomp } rescue []
16 | invalid_values = []
17 | self[attr].split(/,|:/).each do |i|
18 | is_integer = Integer(i) rescue false
19 | unless (is_integer and i.to_i > min and i.to_i < max) or valid_services.include?(i)
20 | invalid_values << i
21 | end
22 | end
23 | if not invalid_values.empty?
24 | errors.add(attr, I18n.t('validations.contract.in_range_or_in_file_invalid', :invalid_values => invalid_values.join(",")))
25 | end
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 | <%= yield :page_header %>
7 | <%= render :partial => "layouts/partials/head" %>
8 |
9 | >
10 |
11 | <%= render :partial => "layouts/partials/header" %>
12 |
13 | <%= render :partial => "layouts/partials/apply_changes_banner" %>
14 | <%= render :partial => "layouts/partials/menu" %>
15 | <%= yield :sequreisp_plugin_menu %>
16 | <%= render :partial => "layouts/partials/notification" %>
17 |
18 | <%= yield :heading %>
19 |
20 | <%= yield %>
21 |
22 | <%= render :partial => "layouts/partials/footer" %>
23 |
24 | <%= render :partial => "layouts/partials/context_help" %>
25 |
26 |
27 |
--------------------------------------------------------------------------------
/vendor/plugins/engines/test/functional/routes_test.rb:
--------------------------------------------------------------------------------
1 | # Tests in this file ensure that:
2 | #
3 | # * Routes from plugins can be routed to
4 | # * Named routes can be defined within a plugin
5 |
6 | require File.dirname(__FILE__) + '/../test_helper'
7 |
8 | class RoutesTest < ActionController::TestCase
9 | tests TestRoutingController
10 |
11 | def test_WITH_a_route_defined_in_a_plugin_IT_should_route_it
12 | path = '/routes/an_action'
13 | opts = {:controller => 'test_routing', :action => 'an_action'}
14 | assert_routing path, opts
15 | assert_recognizes opts, path # not sure what exactly the difference is, but it won't hurt either
16 | end
17 |
18 | def test_WITH_a_route_for_a_namespaced_controller_defined_in_a_plugin_IT_should_route_it
19 | path = 'somespace/routes/an_action'
20 | opts = {:controller => 'namespace/test_routing', :action => 'an_action'}
21 | assert_routing path, opts
22 | assert_recognizes opts, path
23 | end
24 |
25 | def test_should_properly_generate_named_routes
26 | get :test_named_routes_from_plugin
27 | assert_response_body '/somespace/routes'
28 | end
29 | end
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | # Settings specified here will take precedence over those in config/environment.rb
2 |
3 | # The production environment is meant for finished, "live" apps.
4 | # Code is not reloaded between requests
5 | config.cache_classes = true
6 |
7 | # Full error reports are disabled and caching is turned on
8 | config.action_controller.consider_all_requests_local = false
9 | config.action_controller.perform_caching = true
10 | config.action_view.cache_template_loading = true
11 |
12 | # See everything in the log (default is :info)
13 | # config.log_level = :debug
14 |
15 | # Use a different logger for distributed setups
16 | # config.logger = SyslogLogger.new
17 |
18 | # Use a different cache store in production
19 | # config.cache_store = :mem_cache_store
20 |
21 | # Enable serving of images, stylesheets, and javascripts from an asset server
22 | # config.action_controller.asset_host = "http://assets.example.com"
23 |
24 | # Disable delivery errors, bad email addresses will be ignored
25 | config.action_mailer.raise_delivery_errors = false
26 |
27 | # Enable threaded mode
28 | # config.threadsafe!
29 |
--------------------------------------------------------------------------------
/db/migrate/20140529164321_add_attr_for_mail_relay_in_configuration.rb:
--------------------------------------------------------------------------------
1 | class AddAttrForMailRelayInConfiguration < ActiveRecord::Migration
2 | def self.up
3 | add_column :configurations, :mail_relay_manipulated_for_sequreisp, :boolean, :default => false
4 | add_column :configurations, :mail_relay_used, :boolean, :default => false
5 | add_column :configurations, :mail_relay_option_server, :string
6 | add_column :configurations, :mail_relay_smtp_server, :string
7 | add_column :configurations, :mail_relay_smtp_port, :integer
8 | add_column :configurations, :mail_relay_mail, :string
9 | add_column :configurations, :mail_relay_password, :string
10 | end
11 |
12 | def self.down
13 | remove_column :configurations, :mail_relay_manipulated_for_sequreisp
14 | remove_column :configurations, :mail_relay_used
15 | remove_column :configurations, :mail_relay_option_server
16 | remove_column :configurations, :mail_relay_smtp_server
17 | remove_column :configurations, :mail_relay_smtp_port
18 | remove_column :configurations, :mail_relay_mail
19 | remove_column :configurations, :mail_relay_password
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/public/stylesheets/scaffold.css:
--------------------------------------------------------------------------------
1 | body { background-color: #fff; color: #333; }
2 |
3 | body, p, ol, ul, td {
4 | font-family: verdana, arial, helvetica, sans-serif;
5 | font-size: 13px;
6 | line-height: 18px;
7 | }
8 |
9 | pre {
10 | background-color: #eee;
11 | padding: 10px;
12 | font-size: 11px;
13 | }
14 |
15 | a { color: #000; }
16 | a:visited { color: #666; }
17 | a:hover { color: #fff; background-color:#000; }
18 |
19 | .fieldWithErrors {
20 | padding: 2px;
21 | background-color: red;
22 | display: table;
23 | }
24 |
25 | #errorExplanation {
26 | width: 400px;
27 | border: 2px solid red;
28 | padding: 7px;
29 | padding-bottom: 12px;
30 | margin-bottom: 20px;
31 | background-color: #f0f0f0;
32 | }
33 |
34 | #errorExplanation h2 {
35 | text-align: left;
36 | font-weight: bold;
37 | padding: 5px 5px 5px 15px;
38 | font-size: 12px;
39 | margin: -7px;
40 | background-color: #c00;
41 | color: #fff;
42 | }
43 |
44 | #errorExplanation p {
45 | color: #333;
46 | margin-bottom: 0;
47 | padding: 5px;
48 | }
49 |
50 | #errorExplanation ul li {
51 | font-size: 12px;
52 | list-style: square;
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/lib/ip_address_check.rb:
--------------------------------------------------------------------------------
1 | module IpAddressCheck
2 |
3 | def self.included(base)
4 | return if base.include? InstanceMethods
5 |
6 | base.send(:include, InstanceMethods)
7 | base.send(:extend, ClassMethods)
8 |
9 | base.class_eval do
10 | @__ip_fields ||= []
11 | validate :check_ip_fields
12 | end
13 | end
14 | module ClassMethods
15 | def validate_ip_format_of(*args)
16 | options = args.extract_options!
17 | @__ip_fields += args
18 | args.each do |f|
19 | unless options[:with_netmask]
20 | validates_format_of f, :with => /^([12]{0,1}[0-9]{0,1}[0-9]{1}\.){3}[12]{0,1}[0-9]{0,1}[0-9]{1}$/, :allow_blank => true
21 | end
22 | end
23 | end
24 | end
25 |
26 | module InstanceMethods
27 | def check_ip_fields
28 | fields = self.class.instance_eval do @__ip_fields end
29 | fields.each do |f|
30 | next if self[f].blank?
31 | begin
32 | ip = IP.new self[f]
33 | self[f] = ip.to_s
34 | rescue
35 | errors.add f, I18n.t("validations.ip_is_not_valid")
36 | end
37 | end
38 | end
39 | end
40 | end
41 |
--------------------------------------------------------------------------------
/vendor/plugins/engines/MIT-LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2008 James Adam
2 |
3 | The MIT License
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/vendor/plugins/validation_reflection/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2006 Michael Schuerig
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/lib/generators/sequreisp_plugin/templates/MIT-LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011 [name of plugin creator]
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/public/stylesheets/formtastic_changes.css:
--------------------------------------------------------------------------------
1 | /* -------------------------------------------------------------------------------------------------
2 |
3 | Load this stylesheet after formtastic.css in your layouts to override the CSS to suit your needs.
4 | This will allow you to update formtastic.css with new releases without clobbering your own changes.
5 |
6 | For example, to make the inline hint paragraphs a little darker in color than the standard #666:
7 |
8 | form.formtastic fieldset ol li p.inline-hints { color:#333; }
9 |
10 | --------------------------------------------------------------------------------------------------*/
11 |
12 | form.formtastic fieldset ol li.string input { width:220px; }
13 | form.formtastic fieldset ol li.password input { width:220px; }
14 | form.formtastic fieldset ol li.numeric input { width:220px; }
15 | form.formtastic fieldset ol li.text textarea { width:220px; }
16 |
17 | form.formtastic fieldset ol li label { }
18 | /*required rojo*/
19 | form.formtastic abbr, form.formtastic acronym { color: #F00; }
20 |
21 | /*inline hints*/
22 | form.formtastic fieldset ol li p.inline-hints { font-size: 11px; }
23 | form.formtastic fieldset ol li p.inline-errors { font-size: 11px; }
24 |
--------------------------------------------------------------------------------
/vendor/plugins/validation_reflection/CHANGELOG:
--------------------------------------------------------------------------------
1 | == 0.3.5, 2009-10-09
2 | * version bump
3 |
4 | == 0.3.4, 2009-10-09
5 | * Enhancements from Jonas Grimfelt
6 | ** Don't include instead of explicit namespaces to make the code much DRY:er and readable
7 | ** Avoid mutable strings
8 | ** Be clear about the namespaces for external classes (to avoid Ruby 1.9.x issues)
9 | ** Fixing gem loading issues on Ruby 1.9.x
10 | ** Removed the freezing of validations
11 |
12 | == 0.3.3, 2009-09-12
13 | * version bump
14 |
15 | == 0.3.2, 2009-09-12
16 | * gemified by Christopher Redinger
17 |
18 | == 0.3.1, 2008-01-03
19 | * require 'ostruct'; thanks to Georg Friedrich.
20 |
21 | == 0.3, 2008-01-01
22 | * Added configurability in config/plugins/validation_reflection.rb
23 |
24 | == 0.2.1, 2006-12-28
25 | * Moved lib files into subfolder boiler_plate.
26 |
27 | == 0.2, 2006-08-06
28 | ?
29 |
30 | = Deprecation Notice
31 |
32 | Version 0.1 had supplied three methods
33 |
34 | - validates_presence_of_mandatory_content_columns
35 | - validates_lengths_of_string_attributes
36 | - validates_all_associated
37 |
38 | These have been removed. Please use the Enforce Schema Rules plugin instead
39 |
40 | http://enforce-schema-rules.googlecode.com/svn/trunk/enforce_schema_rules/
41 |
--------------------------------------------------------------------------------
/app/helpers/graphs_helper.rb:
--------------------------------------------------------------------------------
1 | # Sequreisp - Copyright 2010, 2011 Luciano Ruete
2 | #
3 | # This file is part of Sequreisp.
4 | #
5 | # Sequreisp is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Afero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Sequreisp is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Afero General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Afero General Public License
16 | # along with Sequreisp. If not, see .
17 |
18 | module GraphsHelper
19 | def instant_rate_path
20 | case @graph.element.class.to_s
21 | when "Contract"
22 | instant_rate_contract_path(@graph.element)
23 | when "Provider"
24 | instant_rate_interface_path(@graph.element.interface)
25 | when "ProviderGroup"
26 | instant_rate_provider_group_path(@graph.element)
27 | when "Interface"
28 | instant_rate_interface_path(@graph.element)
29 | end
30 | end
31 | end
32 |
--------------------------------------------------------------------------------
/public/stylesheets/application.css:
--------------------------------------------------------------------------------
1 |
2 | /*--------------------------------------------------------------------------------------------------
3 | PAGE DEFINITIONS
4 | --------------------------------------------------------------------------------------------------*/
5 |
6 | body {
7 | min-width: 100%;
8 | font-family: "Helvetica Neue", Helvetica, clean, sans-serif;
9 | font-size: 13px;
10 | }
11 |
12 | #container {
13 | }
14 |
15 | h1 {
16 | font-size: 24px;
17 | font-weight: normal;
18 | margin: 6px 0 24px 0;
19 | }
20 |
21 | #buttons {
22 | height: 50px;
23 | }
24 |
25 | #links {
26 | height: 50px;
27 | }
28 |
29 | /*
30 | Deprecated in favor of foldeable menues
31 | #plugins_menu {
32 | display:none;
33 | border-top: #C4C4B5 solid 1px;
34 | }
35 | */
36 |
37 | div#apply_changes_banner{
38 | background-color: #B6B6B6;
39 | height: 40px;
40 | margin: 0 -20px 0 -20px;
41 |
42 | }
43 |
44 | div#apply_changes_banner a{
45 | background-color: #B6B6B6;
46 | }
47 | div#apply_changes_banner span#apply_changes_notice{
48 | line-height: 40px;
49 | margin:0 20px;
50 | color: #900;
51 | font-weight: bold;
52 | }
53 |
54 | div#apply_changes_button{
55 | float:right;
56 | padding-right: 20px;
57 | margin-top: 7px;
58 | }
59 |
60 |
61 |
--------------------------------------------------------------------------------
/spec/factories.rb:
--------------------------------------------------------------------------------
1 | Factory.define :client do |f|
2 | f.sequence(:name) { |n| Faker::Name.name + n.to_s }
3 | f.sequence(:email) { |n| n.to_s + Faker::Internet.email }
4 | f.phone Faker::PhoneNumber.phone_number
5 | end
6 |
7 | Factory.define :plan do |f|
8 | f.sequence(:name) {|n| "Test Plan #{n}" }
9 | f.association :provider_group
10 | f.rate_down 0
11 | f.ceil_down 256
12 | f.rate_up 0
13 | f.ceil_up 128
14 | f.transparent_proxy true
15 | end
16 |
17 | Factory.define :contract do |f|
18 | f.sequence(:ip) { |n| "192.168.1.#{n}" }
19 | f.ceil_dfl_percent 70
20 | f.association :client
21 | f.association :plan
22 | end
23 |
24 | Factory.define :provider_group do |f|
25 | f.sequence(:name) {|n| "Test Provider Group #{n}" }
26 | f.after_build do |u|
27 | Factory.create(:provider, :provider_group => u)
28 | end
29 | end
30 |
31 | Factory.define :provider do |f|
32 | f.association :provider_group
33 | f.association :interface
34 | f.sequence(:name) { |n| "Test Provider#{n}" }
35 | f.rate_down 10000000000
36 | f.rate_up 10000000000
37 | f.sequence(:ip) { |n| "192.168.0.#{n}" }
38 | f.kind 'static'
39 | f.netmask '255.255.255.0'
40 | f.gateway '192.168.0.254'
41 | end
42 |
43 | Factory.define :interface do |f|
44 | f.sequence(:name) { |n| 'eth' + n.to_s }
45 | end
46 |
--------------------------------------------------------------------------------
/public/javascripts/jquery.autogrowtextarea.js:
--------------------------------------------------------------------------------
1 | /*!
* Autogrow Textarea Plugin Version v2.0
* http://www.technoreply.com/autogrow-textarea-plugin-version-2-0
*
* Copyright 2011, Jevin O. Sewaruth
*
* Date: March 13, 2011
*/
jQuery.fn.autoGrow = function(){
return this.each(function(){
// Variables
var colsDefault = this.cols;
var rowsDefault = this.rows;
//Functions
var grow = function() {
growByRef(this);
}
var growByRef = function(obj) {
var linesCount = 0;
var lines = obj.value.split('\n');
for (var i=lines.length-1; i>=0; --i)
{
linesCount += Math.floor((lines[i].length / colsDefault) + 1);
}
if (linesCount >= rowsDefault)
obj.rows = linesCount + 1;
else
obj.rows = rowsDefault;
}
var characterWidth = function (obj){
var characterWidth = 0;
var temp1 = 0;
var temp2 = 0;
var tempCols = obj.cols;
obj.cols = 1;
temp1 = obj.offsetWidth;
obj.cols = 2;
temp2 = obj.offsetWidth;
characterWidth = temp2 - temp1;
obj.cols = tempCols;
return characterWidth;
}
// Manipulations
this.style.width = "auto";
this.style.height = "auto";
this.style.overflow = "hidden";
this.style.width = ((characterWidth(this) * this.cols) + 6) + "px";
this.onkeyup = grow;
this.onfocus = grow;
this.onblur = grow;
growByRef(this);
});
};
--------------------------------------------------------------------------------
/vendor/plugins/engines/test/functional/view_helpers_test.rb:
--------------------------------------------------------------------------------
1 | require File.dirname(__FILE__) + '/../test_helper'
2 |
3 | class ViewHelpersTest < ActionController::TestCase
4 | tests AssetsController
5 |
6 | def setup
7 | get :index
8 | end
9 |
10 | def test_plugin_javascript_helpers
11 | base_selector = "script[type='text/javascript']"
12 | js_dir = "/plugin_assets/test_assets/javascripts"
13 | assert_select "#{base_selector}[src='#{js_dir}/file.1.js']"
14 | assert_select "#{base_selector}[src='#{js_dir}/file2.js']"
15 | end
16 |
17 | def test_plugin_stylesheet_helpers
18 | base_selector = "link[media='screen'][rel='stylesheet'][type='text/css']"
19 | css_dir = "/plugin_assets/test_assets/stylesheets"
20 | assert_select "#{base_selector}[href='#{css_dir}/file.1.css']"
21 | assert_select "#{base_selector}[href='#{css_dir}/file2.css']"
22 | end
23 |
24 | def test_plugin_image_helpers
25 | assert_select "img[src='/plugin_assets/test_assets/images/image.png'][alt='Image']"
26 | end
27 |
28 | def test_plugin_layouts
29 | get :index
30 | assert_select "div[id='assets_layout']"
31 | end
32 |
33 | def test_plugin_image_submit_helpers
34 | assert_select "input[src='/plugin_assets/test_assets/images/image.png'][type='image']"
35 | end
36 |
37 | end
38 |
--------------------------------------------------------------------------------
/vendor/plugins/engines/lib/engines/plugin/list.rb:
--------------------------------------------------------------------------------
1 | # The PluginList class is an array, enhanced to allow access to loaded plugins
2 | # by name, and iteration over loaded plugins in order of priority. This array is used
3 | # by Engines::RailsExtensions::RailsInitializer to create the Engines.plugins array.
4 | #
5 | # Each loaded plugin has a corresponding Plugin instance within this array, and
6 | # the order the plugins were loaded is reflected in the entries in this array.
7 | #
8 | # For more information, see the Rails module.
9 | module Engines
10 | class Plugin
11 | class List < Array
12 | # Finds plugins with the set with the given name (accepts Strings or Symbols), or
13 | # index. So, Engines.plugins[0] returns the first-loaded Plugin, and Engines.plugins[:engines]
14 | # returns the Plugin instance for the engines plugin itself.
15 | def [](name_or_index)
16 | if name_or_index.is_a?(Fixnum)
17 | super
18 | else
19 | self.find { |plugin| plugin.name.to_s == name_or_index.to_s }
20 | end
21 | end
22 |
23 | # Go through each plugin, highest priority first (last loaded first). Effectively,
24 | # this is like Engines.plugins.reverse
25 | def by_precedence
26 | reverse
27 | end
28 | end
29 | end
30 | end
--------------------------------------------------------------------------------
/app/views/configurations/named.conf.options.erb:
--------------------------------------------------------------------------------
1 | options {
2 | directory "/var/cache/bind";
3 |
4 | // If there is a firewall between you and nameservers you want
5 | // to talk to, you may need to fix the firewall to allow multiple
6 | // ports to talk. See http://www.kb.cert.org/vuls/id/800113
7 |
8 | // If your ISP provided one or more IP addresses for stable
9 | // nameservers, you probably want to use them as forwarders.
10 | // Uncomment the following block, and insert the addresses replacing
11 | // the all-0's placeholder.
12 |
13 | <% params[:forwarders].each do |server| %>
14 | <%= server %>
15 | <% end %>
16 |
17 | //allow-query {
18 | // 127.0.0.1;
19 | // 192.168.0.0/16;
20 | // 10.0.0.0/8;
21 | // 172.16.0.0/12;
22 | // 192.0.2.0/24;
23 | // 198.18.0.0/15;
24 | //};
25 | auth-nxdomain no; # conform to RFC1035
26 | max-ncache-ttl 1;
27 | #no limito a 90M el cache de bind
28 | max-cache-size 200M;
29 | recursive-clients 3000;
30 | datasize unlimited;
31 | listen-on { !192.0.2.0/24; !198.18.0.0/15; any; };
32 | listen-on-v6 { none; };
33 | allow-query { any; };
34 | };
--------------------------------------------------------------------------------
/public/500.en.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 | We're sorry, but something went wrong (500)
9 |
17 |
18 |
19 |
20 |
21 |
22 |

23 |
There was a problem serving the requested page.
24 |
Usually this means that an unexpected error happened while processing
25 | your request. Here's what you can try next:
26 |
27 |
Refresh this page, the problem may be temporary.
28 |
If the problem persist, contact us and we'll help get you on you way.
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/views/user_sessions/new.html.erb:
--------------------------------------------------------------------------------
1 |
22 | <% content_for :title, t('actions.login') %>
23 |
24 |
<%=t 'actions.login' %>
25 | <% form_for @user_session, :url => user_session_path do |f| %>
26 | <%= f.error_messages %>
27 | <%= f.label :email %>
28 | <% if @user_session_email.present? %>
29 | <%= f.text_field :email, :value => @user_session_email %>
30 | <% else %>
31 | <%= f.text_field :email %>
32 | <% end %>
33 | <%= f.label :password %>
34 | <% if @user_session_password.present? %>
35 | <%= f.password_field :password, :value => @user_session_password %>
36 | <% else %>
37 | <%= f.password_field :password %>
38 | <% end %>
39 | <%= f.submit t('buttons.login'), :class => "btn_submit btn_login" %>
40 | <% end %>
41 |
42 |
43 |
--------------------------------------------------------------------------------