├── lib ├── tasks │ ├── .gitkeep │ ├── secret_token.rake │ ├── tokens.rake │ └── cucumber.rake ├── hostname_validator.rb ├── ip_address_validator.rb ├── record_patterns.rb ├── scoped_finders.rb └── hijacker.rb ├── log └── .gitignore ├── public ├── favicon.ico ├── stylesheets │ └── .gitkeep ├── images │ ├── error.png │ ├── help.png │ ├── lock.png │ ├── rails.png │ ├── table.png │ ├── accept.png │ ├── cancel.png │ ├── loading.gif │ ├── user_go.png │ ├── brick_add.png │ ├── brick_edit.png │ ├── brick_go.png │ ├── flag_green.png │ ├── note_add.png │ ├── note_edit.png │ ├── table_add.png │ ├── table_edit.png │ ├── table_save.png │ ├── user_add.png │ ├── user_edit.png │ ├── brick_delete.png │ ├── database_add.png │ ├── exclamation.png │ ├── flag_orange.png │ ├── table_delete.png │ ├── table_error.png │ ├── user_delete.png │ ├── user_suspend.png │ ├── database_delete.png │ ├── database_edit.png │ ├── report_magnify.png │ ├── top-background.png │ └── prototip │ │ └── styles │ │ ├── creamy │ │ ├── close.png │ │ ├── lefttop.png │ │ ├── loader.gif │ │ ├── topleft.png │ │ ├── righttop.png │ │ ├── topmiddle.png │ │ ├── topright.png │ │ ├── bottomleft.png │ │ ├── bottommiddle.png │ │ ├── bottomright.png │ │ ├── close_hover.png │ │ ├── leftbottom.png │ │ ├── leftmiddle.png │ │ ├── rightbottom.png │ │ └── rightmiddle.png │ │ ├── darkgrey │ │ ├── close.png │ │ ├── lefttop.png │ │ ├── loader.gif │ │ ├── topleft.png │ │ ├── bottomleft.png │ │ ├── leftbottom.png │ │ ├── leftmiddle.png │ │ ├── righttop.png │ │ ├── topmiddle.png │ │ ├── topright.png │ │ ├── bottommiddle.png │ │ ├── bottomright.png │ │ ├── close_hover.png │ │ ├── rightbottom.png │ │ └── rightmiddle.png │ │ ├── default │ │ ├── close.png │ │ ├── loader.gif │ │ ├── lefttop.png │ │ ├── righttop.png │ │ ├── topleft.png │ │ ├── topright.png │ │ ├── bottomleft.png │ │ ├── bottomright.png │ │ ├── close_hover.png │ │ ├── leftbottom.png │ │ ├── leftmiddle.png │ │ ├── rightbottom.png │ │ ├── rightmiddle.png │ │ ├── topmiddle.png │ │ └── bottommiddle.png │ │ ├── protoblue │ │ ├── close.png │ │ ├── loader.gif │ │ ├── lefttop.png │ │ ├── righttop.png │ │ ├── topleft.png │ │ ├── topmiddle.png │ │ ├── topright.png │ │ ├── bottomleft.png │ │ ├── bottomright.png │ │ ├── close_hover.png │ │ ├── leftbottom.png │ │ ├── leftmiddle.png │ │ ├── rightbottom.png │ │ ├── rightmiddle.png │ │ └── bottommiddle.png │ │ └── protogrey │ │ ├── close.png │ │ ├── loader.gif │ │ ├── lefttop.png │ │ ├── righttop.png │ │ ├── topleft.png │ │ ├── topmiddle.png │ │ ├── topright.png │ │ ├── bottomleft.png │ │ ├── bottomright.png │ │ ├── close_hover.png │ │ ├── leftbottom.png │ │ ├── leftmiddle.png │ │ ├── rightbottom.png │ │ ├── rightmiddle.png │ │ └── bottommiddle.png ├── robots.txt ├── dispatch.cgi ├── dispatch.rb ├── 422.html ├── 404.html ├── 500.html ├── dispatch.fcgi ├── .htaccess └── javascripts │ └── application.js ├── .rspec ├── .ruby-version ├── vendor └── plugins │ └── .gitkeep ├── app ├── helpers │ ├── users_helper.rb │ ├── records_helper.rb │ ├── reports_helper.rb │ ├── search_helper.rb │ ├── sessions_helper.rb │ ├── dashboard_helper.rb │ ├── templates_helper.rb │ ├── auth_tokens_helper.rb │ ├── macro_steps_helper.rb │ ├── macros_helper.rb │ ├── domains_helper.rb │ ├── audits_helper.rb │ └── application_helper.rb ├── views │ ├── domains │ │ ├── index.json.rabl │ │ ├── show.json.rabl │ │ ├── change_owner.js.erb │ │ ├── create.json.rabl │ │ ├── new.html.haml │ │ ├── update_note.js.erb │ │ ├── apply_macro.json.rabl │ │ ├── apply_macro.html.haml │ │ ├── index.html.haml │ │ ├── _domain.html.haml │ │ ├── edit.html.haml │ │ ├── _record.html.haml │ │ └── _soa_record.html.haml │ ├── users │ │ ├── new.html.haml │ │ ├── edit.html.haml │ │ ├── index.html.haml │ │ ├── show.html.haml │ │ ├── _form.html.haml │ │ └── _user.html.haml │ ├── audits │ │ ├── index.html.haml │ │ ├── _domain_audit.html.haml │ │ ├── _record_audit.html.haml │ │ └── domain.html.haml │ ├── macros │ │ ├── _macro.html.haml │ │ ├── index.html.haml │ │ └── edit.html.haml │ ├── sessions │ │ ├── token.html.haml │ │ └── new.html.erb │ ├── templates │ │ ├── new.html.haml │ │ ├── edit.html.haml │ │ ├── _zone_template.html.haml │ │ ├── index.html.haml │ │ └── _form.html.haml │ ├── user_mailer │ │ ├── activation.html.erb │ │ └── signup_notification.html.erb │ ├── reports │ │ ├── _user.html.haml │ │ ├── view.html.haml │ │ ├── results.html.haml │ │ └── index.html.haml │ ├── devise │ │ ├── mailer │ │ │ ├── confirmation_instructions.html.erb │ │ │ ├── unlock_instructions.html.erb │ │ │ └── reset_password_instructions.html.erb │ │ ├── unlocks │ │ │ └── new.html.erb │ │ ├── passwords │ │ │ ├── new.html.erb │ │ │ └── edit.html.erb │ │ ├── confirmations │ │ │ └── new.html.erb │ │ ├── registrations │ │ │ ├── new.html.erb │ │ │ └── edit.html.erb │ │ └── shared │ │ │ └── _links.erb │ ├── dashboard │ │ └── index.html.haml │ ├── search │ │ └── results.html.haml │ ├── records │ │ ├── update_soa.js.erb │ │ ├── create.js.erb │ │ └── update.js.erb │ ├── macro_steps │ │ ├── update.js.erb │ │ ├── create.js.erb │ │ └── _macro_step.html.haml │ ├── record_templates │ │ ├── update.js.erb │ │ └── create.js.erb │ └── layouts │ │ └── application.html.haml ├── controllers │ ├── sessions_controller.rb │ ├── dashboard_controller.rb │ ├── audits_controller.rb │ ├── application_controller.rb │ ├── templates_controller.rb │ ├── reports_controller.rb │ ├── users_controller.rb │ ├── search_controller.rb │ ├── macros_controller.rb │ ├── record_templates_controller.rb │ ├── macro_steps_controller.rb │ └── records_controller.rb └── models │ ├── user_observer.rb │ ├── sshfp.rb │ ├── ptr.rb │ ├── cname.rb │ ├── loc.rb │ ├── mx.rb │ ├── txt.rb │ ├── a.rb │ ├── spf.rb │ ├── aaaa.rb │ ├── user_mailer.rb │ ├── srv.rb │ ├── ns.rb │ └── macro_step.rb ├── config ├── initializers │ ├── rabl.rb │ ├── fix_audited.rb │ ├── mime_types.rb │ ├── inflections.rb │ ├── backtrace_silencers.rb │ ├── session_store.rb │ └── new_rails_defaults.rb ├── environment.rb ├── boot.rb ├── cucumber.yml ├── database.yml.template ├── routes.rb ├── environments │ ├── cucumber.rb │ ├── development.rb │ ├── test.rb │ └── production.rb ├── locales │ └── devise.en.yml └── application.rb ├── spec ├── models │ ├── loc_spec.rb │ ├── ptr_spec.rb │ ├── spf_spec.rb │ ├── srv_spec.rb │ ├── ns_spec.rb │ ├── cname_spec.rb │ ├── txt_spec.rb │ ├── aaaa_spec.rb │ ├── a_spec.rb │ ├── mx_spec.rb │ └── macro_spec.rb ├── factories │ ├── sign_in_helpers.rb │ ├── auth_token_factory.rb │ ├── macro_factory.rb │ ├── zone_template_factory.rb │ ├── users_factory.rb │ └── domain_factory.rb ├── helpers │ ├── macros_helper_spec.rb │ ├── macro_steps_helper_spec.rb │ └── application_helper_spec.rb ├── controllers │ ├── dashboard_controller_spec.rb │ ├── audits_controller_spec.rb │ ├── sessions_controller_spec.rb │ ├── record_template_controller_spec.rb │ ├── reports_controller_spec.rb │ ├── templates_controller_spec.rb │ └── search_controller_spec.rb ├── views │ ├── domains │ │ ├── apply_macro.html.haml_spec.rb │ │ └── new.html.haml_spec.rb │ ├── templates │ │ ├── edit.html.haml_spec.rb │ │ ├── new.html.haml_spec.rb │ │ └── show.html.haml_spec.rb │ ├── macros │ │ ├── index.html.haml_spec.rb │ │ ├── show.html.haml_spec.rb │ │ └── edit.html.haml_spec.rb │ ├── reports │ │ └── results.html.haml_spec │ ├── macro_steps │ │ ├── create.js.rjs_spec.rb │ │ └── update.js.rjs_spec.rb │ ├── search │ │ └── results.html.haml_spec.rb │ └── audits │ │ └── domain.html.haml_spec.rb └── spec_helper.rb ├── stories ├── all.rb └── helper.rb ├── .gitignore ├── config.ru ├── db └── migrate │ ├── 20130419205056_add_reset_password_sent_at_to_users.rb │ ├── 006_add_zone_owners.rb │ ├── 007_add_notes_to_domains.rb │ ├── 20101114093243_add_comment_to_audits.rb │ ├── 008_users_can_own_zone_templates.rb │ ├── 20130429134229_add_type_master_to_zone_template.rb │ ├── 20101114093245_add_remote_address_to_audits.rb │ ├── 20101114093244_rename_changes_to_audited_changes.rb │ ├── 20090505124622_disallow_null_values_in_macro_steps_positions.rb │ ├── 010_create_auth_tokens.rb │ ├── 20110218154001_rename_parent_to_association.rb │ ├── 001_create_domains.rb │ ├── 005_create_roles.rb │ ├── 002_create_records.rb │ ├── 003_create_templates.rb │ ├── 20081228121040_create_macros.rb │ ├── 004_create_users.rb │ ├── 20120819220815_rename_association_to_associated.rb │ ├── 009_add_audit_support.rb │ ├── 20101118071851_convert_roles_to_columns_on_user.rb │ └── 20110306115116_devise_create_users.rb ├── doc ├── README_FOR_APP └── examples │ └── tokens │ └── read_only.xml.erb ├── test ├── performance │ └── browsing_test.rb └── test_helper.rb ├── Rakefile ├── script ├── rails ├── cucumber └── provision ├── .travis.yml ├── Vagrantfile ├── CREDITS.textile ├── features └── support │ ├── paths.rb │ ├── selectors.rb │ └── env.rb ├── TODO.textile ├── Gemfile ├── LICENSE └── CONVENTIONS.textile /lib/tasks/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /log/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --colour 2 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.1.4 2 | -------------------------------------------------------------------------------- /vendor/plugins/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/stylesheets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/helpers/users_helper.rb: -------------------------------------------------------------------------------- 1 | module UsersHelper 2 | end -------------------------------------------------------------------------------- /app/helpers/records_helper.rb: -------------------------------------------------------------------------------- 1 | module RecordsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/reports_helper.rb: -------------------------------------------------------------------------------- 1 | module ReportsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/search_helper.rb: -------------------------------------------------------------------------------- 1 | module SearchHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/sessions_helper.rb: -------------------------------------------------------------------------------- 1 | module SessionsHelper 2 | end -------------------------------------------------------------------------------- /app/helpers/dashboard_helper.rb: -------------------------------------------------------------------------------- 1 | module DashboardHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/templates_helper.rb: -------------------------------------------------------------------------------- 1 | module TemplatesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/auth_tokens_helper.rb: -------------------------------------------------------------------------------- 1 | module AuthTokensHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/macro_steps_helper.rb: -------------------------------------------------------------------------------- 1 | module MacroStepsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/views/domains/index.json.rabl: -------------------------------------------------------------------------------- 1 | collection @domains 2 | attributes :id, :name, :type 3 | -------------------------------------------------------------------------------- /app/views/users/new.html.haml: -------------------------------------------------------------------------------- 1 | %h1.underline New user 2 | 3 | = render :partial => 'form' 4 | -------------------------------------------------------------------------------- /app/views/users/edit.html.haml: -------------------------------------------------------------------------------- 1 | %h1.underline Update user 2 | 3 | = render :partial => 'form' 4 | 5 | -------------------------------------------------------------------------------- /app/controllers/sessions_controller.rb: -------------------------------------------------------------------------------- 1 | class SessionsController < Devise::SessionsController 2 | end 3 | -------------------------------------------------------------------------------- /config/initializers/rabl.rb: -------------------------------------------------------------------------------- 1 | Rabl.configure do |config| 2 | config.include_json_root = false 3 | end 4 | -------------------------------------------------------------------------------- /public/images/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/error.png -------------------------------------------------------------------------------- /public/images/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/help.png -------------------------------------------------------------------------------- /public/images/lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/lock.png -------------------------------------------------------------------------------- /public/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/rails.png -------------------------------------------------------------------------------- /public/images/table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/table.png -------------------------------------------------------------------------------- /spec/models/loc_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe LOC do 4 | it "should be tested" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/ptr_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PTR do 4 | it "should have tests" 5 | end 6 | -------------------------------------------------------------------------------- /app/helpers/macros_helper.rb: -------------------------------------------------------------------------------- 1 | module MacrosHelper 2 | 3 | def possible_owners 4 | User.all 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /public/images/accept.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/accept.png -------------------------------------------------------------------------------- /public/images/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/cancel.png -------------------------------------------------------------------------------- /public/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/loading.gif -------------------------------------------------------------------------------- /public/images/user_go.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/user_go.png -------------------------------------------------------------------------------- /spec/models/spf_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe SPF do 4 | pending "should have tests" 5 | end 6 | -------------------------------------------------------------------------------- /app/views/audits/index.html.haml: -------------------------------------------------------------------------------- 1 | %h1.underline= t :title_audit_search_logs 2 | 3 | %em= t :text_audit_comming_soon 4 | -------------------------------------------------------------------------------- /app/views/macros/_macro.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td 3 | = link_to macro.name, macro_path( macro ) 4 | %td 5 | %td -------------------------------------------------------------------------------- /app/views/sessions/token.html.haml: -------------------------------------------------------------------------------- 1 | %h1= t :title_session_token_expired 2 | 3 | %p= t :text_session_exipired_explain 4 | -------------------------------------------------------------------------------- /app/views/templates/new.html.haml: -------------------------------------------------------------------------------- 1 | %h1.underline= t("title_template_editing.new") 2 | 3 | = render :partial => 'form' 4 | -------------------------------------------------------------------------------- /public/images/brick_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/brick_add.png -------------------------------------------------------------------------------- /public/images/brick_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/brick_edit.png -------------------------------------------------------------------------------- /public/images/brick_go.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/brick_go.png -------------------------------------------------------------------------------- /public/images/flag_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/flag_green.png -------------------------------------------------------------------------------- /public/images/note_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/note_add.png -------------------------------------------------------------------------------- /public/images/note_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/note_edit.png -------------------------------------------------------------------------------- /public/images/table_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/table_add.png -------------------------------------------------------------------------------- /public/images/table_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/table_edit.png -------------------------------------------------------------------------------- /public/images/table_save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/table_save.png -------------------------------------------------------------------------------- /public/images/user_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/user_add.png -------------------------------------------------------------------------------- /public/images/user_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/user_edit.png -------------------------------------------------------------------------------- /app/views/templates/edit.html.haml: -------------------------------------------------------------------------------- 1 | %h1.underline= t("title_template_editing.update") 2 | 3 | = render :partial => 'form' 4 | -------------------------------------------------------------------------------- /public/images/brick_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/brick_delete.png -------------------------------------------------------------------------------- /public/images/database_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/database_add.png -------------------------------------------------------------------------------- /public/images/exclamation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/exclamation.png -------------------------------------------------------------------------------- /public/images/flag_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/flag_orange.png -------------------------------------------------------------------------------- /public/images/table_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/table_delete.png -------------------------------------------------------------------------------- /public/images/table_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/table_error.png -------------------------------------------------------------------------------- /public/images/user_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/user_delete.png -------------------------------------------------------------------------------- /public/images/user_suspend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/user_suspend.png -------------------------------------------------------------------------------- /app/views/user_mailer/activation.html.erb: -------------------------------------------------------------------------------- 1 | <%= t :text_user_mailer_accout_activated, :user => @user.login %> 2 | 3 | <%= @url %> -------------------------------------------------------------------------------- /public/images/database_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/database_delete.png -------------------------------------------------------------------------------- /public/images/database_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/database_edit.png -------------------------------------------------------------------------------- /public/images/report_magnify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/report_magnify.png -------------------------------------------------------------------------------- /public/images/top-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/top-background.png -------------------------------------------------------------------------------- /stories/all.rb: -------------------------------------------------------------------------------- 1 | dir = File.dirname(__FILE__) 2 | Dir[File.expand_path("#{dir}/**/*.rb")].uniq.each do |file| 3 | require file 4 | end -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/close.png -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/lefttop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/lefttop.png -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/loader.gif -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/topleft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/topleft.png -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/close.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/close.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/loader.gif -------------------------------------------------------------------------------- /stories/helper.rb: -------------------------------------------------------------------------------- 1 | ENV["RAILS_ENV"] = "test" 2 | require File.expand_path(File.dirname(__FILE__) + "/../config/environment") 3 | require 'spec/rails/story_adapter' -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .bundle 2 | db/*.sqlite3 3 | log/*.log 4 | *.swp 5 | tmp/* 6 | config/initializers/secret_token.rb 7 | config/database.yml 8 | 9 | /.vagrant 10 | -------------------------------------------------------------------------------- /app/views/reports/_user.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td= link_to user.login, :action => :view , :id => user 3 | %td.right= user.domains.count 4 | %td= user.email 5 | -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/righttop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/righttop.png -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/topmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/topmiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/topright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/topright.png -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/lefttop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/lefttop.png -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/loader.gif -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/topleft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/topleft.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/lefttop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/lefttop.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/righttop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/righttop.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/topleft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/topleft.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/topright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/topright.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/close.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/loader.gif -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/close.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/loader.gif -------------------------------------------------------------------------------- /spec/factories/sign_in_helpers.rb: -------------------------------------------------------------------------------- 1 | module SignInHelpers 2 | def tokenize_as( token ) 3 | @request.session[:token_id] = token ? token.id : nil 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/bottomleft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/bottomleft.png -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/bottommiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/bottommiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/bottomright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/bottomright.png -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/close_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/close_hover.png -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/leftbottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/leftbottom.png -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/leftmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/leftmiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/rightbottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/rightbottom.png -------------------------------------------------------------------------------- /public/images/prototip/styles/creamy/rightmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/creamy/rightmiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/bottomleft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/bottomleft.png -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/leftbottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/leftbottom.png -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/leftmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/leftmiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/righttop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/righttop.png -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/topmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/topmiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/topright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/topright.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/bottomleft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/bottomleft.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/bottomright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/bottomright.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/close_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/close_hover.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/leftbottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/leftbottom.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/leftmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/leftmiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/rightbottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/rightbottom.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/rightmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/rightmiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/topmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/topmiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/lefttop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/lefttop.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/righttop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/righttop.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/topleft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/topleft.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/topmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/topmiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/topright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/topright.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/lefttop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/lefttop.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/righttop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/righttop.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/topleft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/topleft.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/topmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/topmiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/topright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/topright.png -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/bottommiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/bottommiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/bottomright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/bottomright.png -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/close_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/close_hover.png -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/rightbottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/rightbottom.png -------------------------------------------------------------------------------- /public/images/prototip/styles/darkgrey/rightmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/darkgrey/rightmiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/default/bottommiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/default/bottommiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/bottomleft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/bottomleft.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/bottomright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/bottomright.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/close_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/close_hover.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/leftbottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/leftbottom.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/leftmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/leftmiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/rightbottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/rightbottom.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/rightmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/rightmiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/bottomleft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/bottomleft.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/bottomright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/bottomright.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/close_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/close_hover.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/leftbottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/leftbottom.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/leftmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/leftmiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/rightbottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/rightbottom.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/rightmiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/rightmiddle.png -------------------------------------------------------------------------------- /spec/models/srv_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe SRV do 4 | it "should support priorities" do 5 | subject.supports_prio?.should be_true 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/views/domains/show.json.rabl: -------------------------------------------------------------------------------- 1 | object @domain 2 | attributes :id, :name, :type 3 | 4 | child :records => :records do 5 | attributes :id, :name, :type, :content, :prio 6 | end 7 | -------------------------------------------------------------------------------- /public/images/prototip/styles/protoblue/bottommiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protoblue/bottommiddle.png -------------------------------------------------------------------------------- /public/images/prototip/styles/protogrey/bottommiddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kennethkalmer/powerdns-on-rails/HEAD/public/images/prototip/styles/protogrey/bottommiddle.png -------------------------------------------------------------------------------- /config/initializers/fix_audited.rb: -------------------------------------------------------------------------------- 1 | Audit = Audited::Adapters::ActiveRecord::Audit 2 | #TODO: potential vulnarability 3 | Audit.attr_accessible :username, :user, :version, :auditable 4 | -------------------------------------------------------------------------------- /app/views/domains/change_owner.js.erb: -------------------------------------------------------------------------------- 1 | $('#owner-info').html('<%= escape_javascript(@domain.user.nil? ? "-" : @domain.user.login) %>'); 2 | $('#owner-info').show(); 3 | $('#owner-edit').hide(); -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run PowerdnsOnRails::Application 5 | -------------------------------------------------------------------------------- /app/views/domains/create.json.rabl: -------------------------------------------------------------------------------- 1 | object @domain 2 | 3 | attributes :id, :name, :type, :errors 4 | 5 | child :records => :records do 6 | attributes :id, :name, :type, :content, :prio 7 | end 8 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | PowerdnsOnRails::Application.initialize! 6 | -------------------------------------------------------------------------------- /app/views/domains/new.html.haml: -------------------------------------------------------------------------------- 1 | %h1.underline= t :title_domain_new_zone 2 | 3 | = render :partial => 'new' 4 | 5 | %p 6 | 7 | %p 8 | = dns_book t(:label_domain_more_soa_info), t(:link_to_soa_help) -------------------------------------------------------------------------------- /app/controllers/dashboard_controller.rb: -------------------------------------------------------------------------------- 1 | class DashboardController < ApplicationController 2 | 3 | def index 4 | @latest_domains = Domain.user(current_user).order('created_at DESC').limit(5) 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/views/domains/update_note.js.erb: -------------------------------------------------------------------------------- 1 | $('#note-text').html('<%= escape_javascript @domain.notes %>'); 2 | $('#domain_notes').html('<%= escape_javascript @domain.notes %>'); 3 | $('#note-form').hide(); 4 | $('#note').show(); 5 | -------------------------------------------------------------------------------- /db/migrate/20130419205056_add_reset_password_sent_at_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddResetPasswordSentAtToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :reset_password_sent_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /doc/README_FOR_APP: -------------------------------------------------------------------------------- 1 | Use this README file to introduce your application and point to useful places in the API for learning more. 2 | Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-Agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /db/migrate/006_add_zone_owners.rb: -------------------------------------------------------------------------------- 1 | class AddZoneOwners < ActiveRecord::Migration 2 | def self.up 3 | add_column :domains, :user_id, :integer 4 | end 5 | 6 | def self.down 7 | remove_column :domains, :user_id 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /db/migrate/007_add_notes_to_domains.rb: -------------------------------------------------------------------------------- 1 | class AddNotesToDomains < ActiveRecord::Migration 2 | def self.up 3 | add_column :domains, :notes, :text 4 | end 5 | 6 | def self.down 7 | remove_column :domains, :notes 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/views/reports/view.html.haml: -------------------------------------------------------------------------------- 1 | %h2.underline 2 | = @user.login 3 | = t :label_user_has 4 | = t :label_lc_domain, :count => @user.domains.count 5 | 6 | #domains.padded 7 | = render :partial => '/domains/domain' , :collection => @user.domains 8 | -------------------------------------------------------------------------------- /db/migrate/20101114093243_add_comment_to_audits.rb: -------------------------------------------------------------------------------- 1 | class AddCommentToAudits < ActiveRecord::Migration 2 | def self.up 3 | add_column :audits, :comment, :string 4 | end 5 | 6 | def self.down 7 | remove_column :audits, :comment 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/008_users_can_own_zone_templates.rb: -------------------------------------------------------------------------------- 1 | class UsersCanOwnZoneTemplates < ActiveRecord::Migration 2 | def self.up 3 | add_column :zone_templates, :user_id, :integer 4 | end 5 | 6 | def self.down 7 | remove_column :zone_templates, :user_id 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20130429134229_add_type_master_to_zone_template.rb: -------------------------------------------------------------------------------- 1 | class AddTypeMasterToZoneTemplate < ActiveRecord::Migration 2 | def change 3 | add_column :zone_templates, :type, :string, :default => 'NATIVE' 4 | add_column :zone_templates, :master, :string 5 | end 6 | end 7 | 8 | -------------------------------------------------------------------------------- /app/views/user_mailer/signup_notification.html.erb: -------------------------------------------------------------------------------- 1 | <%= t :text_user_mailer_account_created%> 2 | 3 | <%= t :label_user_name %>: <%= @user.login %> 4 | <%= t :label_user_password %>: <%= @user.password %> 5 | 6 | <%= t :text_user_mailer_visit_url_to_activate_account %> 7 | 8 | <%= @url %> -------------------------------------------------------------------------------- /app/views/devise/mailer/confirmation_instructions.html.erb: -------------------------------------------------------------------------------- 1 |
Welcome <%= @resource.email %>!
2 | 3 |You can confirm your account through the link below:
4 | 5 |<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>
6 | -------------------------------------------------------------------------------- /db/migrate/20101114093245_add_remote_address_to_audits.rb: -------------------------------------------------------------------------------- 1 | class AddRemoteAddressToAudits < ActiveRecord::Migration 2 | def self.up 3 | add_column :audits, :remote_address, :string 4 | end 5 | 6 | def self.down 7 | remove_column :audits, :remote_address 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/performance/browsing_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | require 'rails/performance_test_help' 3 | 4 | # Profiling results for each test method are written to tmp/performance. 5 | class BrowsingTest < ActionDispatch::PerformanceTest 6 | def test_homepage 7 | get '/' 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | require 'rake' 6 | 7 | PowerdnsOnRails::Application.load_tasks 8 | -------------------------------------------------------------------------------- /app/views/dashboard/index.html.haml: -------------------------------------------------------------------------------- 1 | %h1.underline 2 | =t :label_last_x_domains, :value => 5 3 | 4 | %table 5 | = render :partial => '/domains/domain', :collection => @latest_domains 6 | 7 | 8 | %h1.underline 9 | = t :label_new_domain 10 | 11 | = render :partial => '/domains/new' 12 | -------------------------------------------------------------------------------- /app/models/user_observer.rb: -------------------------------------------------------------------------------- 1 | class UserObserver < ActiveRecord::Observer 2 | def after_create(user) 3 | UserMailer.deliver_signup_notification(user) 4 | end 5 | 6 | def after_save(user) 7 | 8 | UserMailer.deliver_activation(user) if user.recently_activated? 9 | 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/hostname_validator.rb: -------------------------------------------------------------------------------- 1 | class HostnameValidator < ActiveModel::EachValidator 2 | include RecordPatterns 3 | 4 | def validate_each( record, attribute, value ) 5 | record.errors[ attribute ] << I18n.t(:message_attribute_must_be_hostname) unless hostname?( value ) && !ip?( value ) 6 | end 7 | 8 | end 9 | -------------------------------------------------------------------------------- /app/views/search/results.html.haml: -------------------------------------------------------------------------------- 1 | %h1.underline= t :title_search_result_for, :who => params[:q] 2 | %br/ 3 | 4 | - if @results.empty? 5 | %strong= t :message_search_domain_not_found 6 | - else 7 | %table 8 | = render :partial => '/domains/domain', :collection => @results 9 | 10 | = will_paginate @results -------------------------------------------------------------------------------- /db/migrate/20101114093244_rename_changes_to_audited_changes.rb: -------------------------------------------------------------------------------- 1 | class RenameChangesToAuditedChanges < ActiveRecord::Migration 2 | def self.up 3 | rename_column :audits, :changes, :audited_changes 4 | end 5 | 6 | def self.down 7 | rename_column :audits, :audited_changes, :changes 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /script/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. 3 | 4 | APP_PATH = File.expand_path('../../config/application', __FILE__) 5 | require File.expand_path('../../config/boot', __FILE__) 6 | require 'rails/commands' 7 | -------------------------------------------------------------------------------- /spec/models/ns_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe NS do 4 | context "when new" do 5 | it "should be invalid by default" do 6 | subject.should_not be_valid 7 | end 8 | 9 | it "should require content" do 10 | subject.should have(2).error_on(:content) 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/helpers/domains_helper.rb: -------------------------------------------------------------------------------- 1 | module DomainsHelper 2 | 3 | def select_record_type( form ) 4 | types = if current_user 5 | RecordTemplate.record_types.map{ |t| [t,t] } - [["SOA", "SOA"]] 6 | else 7 | current_token.new_types 8 | end 9 | 10 | form.select( :type, types ) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/views/audits/_domain_audit.html.haml: -------------------------------------------------------------------------------- 1 | %li 2 | = link_to_domain_audit( domain_audit ) 3 | %div[ domain_audit ]{ :style => 'display: none' } 4 | %strong= t :label_audit_time 5 | = domain_audit.created_at 6 | %br 7 | %strong= t :label_audit_changes 8 | %br 9 | = display_hash domain_audit.audited_changes 10 | -------------------------------------------------------------------------------- /db/migrate/20090505124622_disallow_null_values_in_macro_steps_positions.rb: -------------------------------------------------------------------------------- 1 | class DisallowNullValuesInMacroStepsPositions < ActiveRecord::Migration 2 | def self.up 3 | change_column_null :macro_steps, :position, false 4 | end 5 | 6 | def self.down 7 | change_column_null :macro_steps, :position, true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/views/audits/_record_audit.html.haml: -------------------------------------------------------------------------------- 1 | %li 2 | = link_to_record_audit( record_audit ) 3 | %div[ record_audit ]{ :style => 'display: none' } 4 | %strong= t :label_audit_time 5 | = record_audit.created_at 6 | %br 7 | %strong= t :label_audit_changes 8 | %br 9 | = display_hash record_audit.audited_changes 10 | 11 | -------------------------------------------------------------------------------- /spec/models/cname_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe CNAME do 4 | 5 | context "when new" do 6 | 7 | it "should be invalid by default" do 8 | subject.should_not be_valid 9 | end 10 | 11 | it "should require content" do 12 | subject.should have(2).error_on(:content) 13 | end 14 | 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /script/cucumber: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first 4 | if vendored_cucumber_bin 5 | load File.expand_path(vendored_cucumber_bin) 6 | else 7 | require 'rubygems' unless ENV['NO_RUBYGEMS'] 8 | require 'cucumber' 9 | load Cucumber::BINARY 10 | end 11 | -------------------------------------------------------------------------------- /app/views/devise/mailer/unlock_instructions.html.erb: -------------------------------------------------------------------------------- 1 |Hello <%= @resource.email %>!
2 | 3 |Your account has been locked due to an excessive amount of unsuccessful sign in attempts.
4 | 5 |Click the link below to unlock your account:
6 | 7 |<%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %>
8 | -------------------------------------------------------------------------------- /app/views/domains/apply_macro.json.rabl: -------------------------------------------------------------------------------- 1 | # Has the macro been applied yet? 2 | if @macro.present? 3 | # Yes 4 | object @domain 5 | attributes :id, :name, :type 6 | child :records => :records do 7 | attributes :id, :name, :type, :content, :prio 8 | end 9 | 10 | else 11 | # No 12 | collection @macros 13 | attributes :id, :name 14 | 15 | end 16 | -------------------------------------------------------------------------------- /app/models/sshfp.rb: -------------------------------------------------------------------------------- 1 | # See #SSHFP 2 | 3 | # = SSH Fingerprint (SSHFP) 4 | # 5 | # Defined in RFC 4255. 6 | # 7 | # Including draft extension for SHA2 and ECDSA. See https://tools.ietf.org/html/draft-os-ietf-sshfp-ecdsa-sha2-04 8 | 9 | class SSHFP < Record 10 | 11 | validates_format_of :content, :with => /^[1-3] [1-2] ([0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/ 12 | 13 | end 14 | -------------------------------------------------------------------------------- /lib/ip_address_validator.rb: -------------------------------------------------------------------------------- 1 | class IpAddressValidator < ActiveModel::EachValidator 2 | include RecordPatterns 3 | 4 | def validate_each( record, attribute, value ) 5 | record.errors[ attribute ] << I18n.t(:message_attribute_must_be_ip) unless valid?( value ) 6 | end 7 | 8 | def valid?( ip ) 9 | ( options[:ipv6] && ipv6?( ip ) ) || ipv4?( ip ) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/views/users/index.html.haml: -------------------------------------------------------------------------------- 1 | #new-user{ :style => 'display: none' }= t :help_user_add 2 | 3 | %h2.underline= t :title_users 4 | 5 | %table.gridwide 6 | %tr 7 | %td{ :colspan => 5 } 8 | = link_to info_icon('user_add.png', 'new-user'), new_user_path 9 | = link_to t(:label_user_create), new_user_path 10 | = render :partial => 'user', :collection => @users 11 | 12 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | # Set up gems listed in the Gemfile. 4 | gemfile = File.expand_path('../../Gemfile', __FILE__) 5 | begin 6 | ENV['BUNDLE_GEMFILE'] = gemfile 7 | require 'bundler' 8 | Bundler.setup 9 | rescue Bundler::GemNotFound => e 10 | STDERR.puts e.message 11 | STDERR.puts "Try running `bundle install`." 12 | exit! 13 | end if File.exist?(gemfile) 14 | -------------------------------------------------------------------------------- /spec/helpers/macros_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe MacrosHelper do 4 | 5 | #Delete this example and add some real ones or delete this file 6 | it "should be included in the object returned by #helper" do 7 | included_modules = (class << helper; self; end).send :included_modules 8 | included_modules.should include(MacrosHelper) 9 | end 10 | 11 | end 12 | -------------------------------------------------------------------------------- /app/controllers/audits_controller.rb: -------------------------------------------------------------------------------- 1 | class AuditsController < ApplicationController 2 | 3 | before_filter do 4 | unless current_user.admin? 5 | redirect_to root_url 6 | end 7 | end 8 | 9 | def index 10 | 11 | end 12 | 13 | # Retrieve the audit details for a domain 14 | def domain 15 | @domain = Domain.user( current_user ).find( params[:id] ) 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /spec/helpers/macro_steps_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe MacroStepsHelper do 4 | 5 | #Delete this example and add some real ones or delete this file 6 | it "should be included in the object returned by #helper" do 7 | included_modules = (class << helper; self; end).send :included_modules 8 | included_modules.should include(MacroStepsHelper) 9 | end 10 | 11 | end 12 | -------------------------------------------------------------------------------- /app/models/ptr.rb: -------------------------------------------------------------------------------- 1 | # See #PTR 2 | 3 | # = Name Server Record (PTR) 4 | # 5 | # Pointer records are the opposite of A and AAAA RRs and are used in Reverse Map 6 | # zone files to map an IP address (IPv4 or IPv6) to a host name. 7 | # 8 | # Obtained from http://www.zytrax.com/books/dns/ch8/ptr.html 9 | # 10 | class PTR < Record 11 | 12 | validates :content, :presence => true, :hostname => true 13 | 14 | end 15 | -------------------------------------------------------------------------------- /spec/controllers/dashboard_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe DashboardController, "and admins" do 4 | 5 | before(:each) do 6 | sign_in( FactoryGirl.create(:admin) ) 7 | 8 | FactoryGirl.create(:domain) 9 | 10 | get :index 11 | end 12 | 13 | it "should have a list of the latest zones" do 14 | assigns(:latest_domains).should_not be_empty 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /app/views/records/update_soa.js.erb: -------------------------------------------------------------------------------- 1 | $('#soa').replaceWith('<%= escape_javascript render(:partial => '/domains/soa_record', :object => @domain.soa_record) %>'); 2 | 3 | <% if @domain.soa_record.errors.empty? %> 4 | $('#soa-form').hide(); 5 | $('#soa-view').show(); 6 | humane("<%= escape_javascript t(:message_record_soa_updated) %>"); 7 | <% else %> 8 | $('#soa-form').show(); 9 | $('#soa-view').hide(); 10 | <% end %> 11 | -------------------------------------------------------------------------------- /app/models/cname.rb: -------------------------------------------------------------------------------- 1 | # See #CNAME 2 | 3 | # = Canonical Name Record (CNAME) 4 | # 5 | # A CNAME record maps an alias or nickname to the real or Canonical name which 6 | # may lie outside the current zone. Canonical means expected or real name. 7 | # 8 | # Obtained from http://www.zytrax.com/books/dns/ch8/cname.html 9 | # 10 | class CNAME < Record 11 | 12 | validates :content, :presence => true, :hostname => true 13 | 14 | end 15 | -------------------------------------------------------------------------------- /app/views/reports/results.html.haml: -------------------------------------------------------------------------------- 1 | %h1.underline= t :title_report_result_for, :who => params[:q] 2 | %br/ 3 | 4 | - if @results.empty? 5 | %strong= t :message_user_not_found 6 | - else 7 | %table 8 | %th= t :label_user_login 9 | %th= t :label_user_domains 10 | %th= t :label_user_email 11 | %th= t :label_user_role 12 | = render :partial => 'user', :collection => @results 13 | 14 | = will_paginate @results -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format 4 | # (all these examples are active by default): 5 | # ActiveSupport::Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | -------------------------------------------------------------------------------- /app/views/devise/unlocks/new.html.erb: -------------------------------------------------------------------------------- 1 |<%= f.label :email %>
7 | <%= f.email_field :email %>
<%= f.submit "Resend unlock instructions" %>
10 | <% end %> 11 | 12 | <%= render :partial => "devise/shared/links" %> -------------------------------------------------------------------------------- /app/views/devise/passwords/new.html.erb: -------------------------------------------------------------------------------- 1 |<%= f.label :email %>
7 | <%= f.email_field :email %>
<%= f.submit "Send me reset password instructions" %>
10 | <% end %> 11 | 12 | <%= render :partial => "devise/shared/links" %> -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /db/migrate/010_create_auth_tokens.rb: -------------------------------------------------------------------------------- 1 | class CreateAuthTokens < ActiveRecord::Migration 2 | def self.up 3 | create_table :auth_tokens do |t| 4 | t.references :domain 5 | t.references :user 6 | t.string :token, :null => false 7 | t.text :permissions, :null => false 8 | t.timestamps 9 | t.datetime :expires_at, :null => false 10 | end 11 | end 12 | 13 | def self.down 14 | drop_table :auth_tokens 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20110218154001_rename_parent_to_association.rb: -------------------------------------------------------------------------------- 1 | class RenameParentToAssociation < ActiveRecord::Migration 2 | def self.up 3 | rename_column :audits, :auditable_parent_id, :association_id 4 | rename_column :audits, :auditable_parent_type, :association_type 5 | end 6 | 7 | def self.down 8 | rename_column :audits, :association_type, :auditable_parent_type 9 | rename_column :audits, :association_id, :auditable_parent_id 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /doc/examples/tokens/read_only.xml.erb: -------------------------------------------------------------------------------- 1 | 6 |<%= f.label :email %>
7 | <%= f.email_field :email %>
<%= f.submit "Resend confirmation instructions" %>
10 | <% end %> 11 | 12 | <%= render :partial => "devise/shared/links" %> -------------------------------------------------------------------------------- /spec/factories/auth_token_factory.rb: -------------------------------------------------------------------------------- 1 | FactoryGirl.define do 2 | 3 | factory :auth_token do 4 | token '5zuld3g9dv76yosy' 5 | permissions({ 6 | 'policy' => 'deny', 7 | 'new' => false, 8 | 'remove' => false, 9 | 'protected' => [], 10 | 'protected_types' => [], 11 | 'allowed' => [ 12 | ['example.com', '*'], 13 | ['www.example.com', '*'] 14 | ] 15 | }) 16 | expires_at 3.hours.since 17 | end 18 | 19 | end 20 | -------------------------------------------------------------------------------- /spec/views/domains/apply_macro.html.haml_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe "domains/apply_macro.html.haml" do 4 | before(:each) do 5 | @domain = FactoryGirl.create(:domain) 6 | @macro = FactoryGirl.create(:macro) 7 | 8 | assign(:domain, @domain) 9 | assign(:macros, Macro.all) 10 | 11 | render 12 | end 13 | 14 | it "should have a selection of macros" do 15 | rendered.should have_tag('select[name=macro_id]') 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | 3 | protect_from_forgery 4 | 5 | # All pages require a login... 6 | before_filter :authenticate_user! 7 | 8 | # Stub 9 | def current_token 10 | # ... ? 11 | # p [ :current_token ] 12 | nil 13 | end 14 | helper_method :current_token 15 | 16 | # Stub 17 | def token_user? 18 | !!current_token 19 | end 20 | 21 | helper_method :token_user? 22 | end 23 | -------------------------------------------------------------------------------- /app/views/macro_steps/update.js.erb: -------------------------------------------------------------------------------- 1 | <% if @macro_step.errors.empty? %> 2 | $('#show_macro_step_<%= @macro_step.id %>').remove(); 3 | $('#edit_macro_step_<%= @macro_step.id %>').remove(); 4 | $('#marker_macro_step_<%= @macro_step.id %>').replaceWith('<%= escape_javascript render(:partial => @macro_step) %>'); 5 | humane("<%= escape_javascript t(:message_macro_step_updated) %>"); 6 | <% else %> 7 | humane("<%= escape_javascript t(:message_macro_step_cannot_update) %>"); 8 | <% end %> 9 | -------------------------------------------------------------------------------- /app/views/macros/index.html.haml: -------------------------------------------------------------------------------- 1 | %div{ :style => "display: none" } 2 | #new-macro= t :help_macro_new 3 | #delete-macro= t :help_macro_delete 4 | 5 | %ul.start 6 | %li 7 | = link_to new_macro_path do 8 | = info_icon('brick_add.png', 'new-macro') 9 | = link_to t(:label_macro_add), new_macro_path 10 | 11 | %h1.underline Macros 12 | 13 | - if @macros.size > 0 14 | %table 15 | = render :partial => @macros 16 | - else 17 | %em= t :message_macro_not_defined 18 | -------------------------------------------------------------------------------- /app/views/records/create.js.erb: -------------------------------------------------------------------------------- 1 | $('#record-form div.errorExplanation').remove(); 2 | 3 | <% if @record.errors.empty? %> 4 | $('#record-form-div').hide(); 5 | $('#record-form input:text').val(''); 6 | $('#record-table').append('<%= escape_javascript render(:partial => '/domains/record', :object => @record) %>'); 7 | humane('<%= t(:message_record_created) %>'); 8 | <% else %> 9 | $('#record-form').prepend('<%= escape_javascript error_messages_for(@record) %>'); 10 | <% end %> 11 | -------------------------------------------------------------------------------- /app/views/templates/_zone_template.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td= link_to zone_template.name, zone_template_path( zone_template ) 3 | %td 4 | = link_to info_icon('table_edit.png', 'edit-template'), edit_zone_template_path( zone_template ) 5 | = link_to info_icon('table_delete.png', 'delete-template'), zone_template_path( zone_template ), :method => :delete, :confirm => t(:confirm_template_delete) 6 | - unless zone_template.has_soa? 7 | = info_icon('table_error.png', 'missing-soa') 8 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | PowerdnsOnRails::Application.config.session_store :cookie_store, :key => '_powerdns-on-rails_session' 4 | 5 | # Use the database for sessions instead of the cookie-based default, 6 | # which shouldn't be used to store highly confidential information 7 | # (create the session table with "rake db:sessions:create") 8 | # PowerdnsOnRails::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /config/cucumber.yml: -------------------------------------------------------------------------------- 1 | <% 2 | rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" 3 | rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" 4 | std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip" 5 | %> 6 | default: <%= std_opts %> features 7 | wip: --tags @wip:3 --wip features 8 | rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip 9 | -------------------------------------------------------------------------------- /app/views/macro_steps/create.js.erb: -------------------------------------------------------------------------------- 1 | $('#record-form div.errorExplanation').remove(); 2 | 3 | <% if !@macro_step.new_record? %> 4 | $('#record-form-div').hide(); 5 | $('#record-form input:text').val(''); 6 | $('#steps-table').append('<%= escape_javascript render(:partial => @macro_step) %>'); 7 | humane('<%= escape_javascript t(:message_macro_step_created) %>'); 8 | <% else %> 9 | $('#record-form').prepend('<%= escape_javascript error_messages_for(@macro_step) %>'); 10 | <% end %> 11 | -------------------------------------------------------------------------------- /spec/models/txt_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe TXT do 4 | context "when new" do 5 | 6 | it "should be invalid by default" do 7 | subject.should_not be_valid 8 | end 9 | 10 | it "should require content" do 11 | subject.should have(1).error_on(:content) 12 | end 13 | 14 | it "should not tamper with content" do 15 | subject.content = %Q{"google.com"} 16 | subject.content.should eql(%Q{"google.com"}) 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/views/devise/mailer/reset_password_instructions.html.erb: -------------------------------------------------------------------------------- 1 |Hello <%= @resource.email %>!
2 | 3 |Someone has requested a link to change your password, and you can do this through the link below.
4 | 5 |<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
6 | 7 |If you didn't request this, please ignore this email.
8 |Your password won't change until you access the link above and create a new one.
9 | -------------------------------------------------------------------------------- /spec/views/templates/edit.html.haml_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe "templates/edit.html.haml" do 4 | 5 | context "and existing templates" do 6 | 7 | before(:each) do 8 | @zone_template = FactoryGirl.create(:zone_template) 9 | assign(:zone_template, @zone_template) 10 | end 11 | 12 | it "should show the correct title" do 13 | render 14 | 15 | rendered.should have_tag('h1.underline', :content => 'Update Zone Template') 16 | end 17 | end 18 | 19 | end 20 | -------------------------------------------------------------------------------- /public/dispatch.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby18 2 | 3 | require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) 4 | 5 | # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: 6 | # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired 7 | require "dispatcher" 8 | 9 | ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun) 10 | Dispatcher.dispatch -------------------------------------------------------------------------------- /public/dispatch.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby18 2 | 3 | require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) 4 | 5 | # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: 6 | # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired 7 | require "dispatcher" 8 | 9 | ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun) 10 | Dispatcher.dispatch -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV["RAILS_ENV"] = "test" 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. 7 | # 8 | # Note: You'll currently still have to declare fixtures explicitly in integration tests 9 | # -- they do not yet inherit this setting 10 | fixtures :all 11 | 12 | # Add more helper methods to be used by all tests here... 13 | end 14 | -------------------------------------------------------------------------------- /app/views/domains/apply_macro.html.haml: -------------------------------------------------------------------------------- 1 | - @page_title = t :title_macro_for, :domain => @domain.name 2 | 3 | %h1.underline= t :title_macro_apply 4 | 5 | %p= t :text_macro_description 6 | 7 | = form_tag( apply_macro_domain_path( @domain ) ) do 8 | %table.grid 9 | %tr 10 | %td= t :label_macro_sign 11 | %td= select_tag :macro_id, options_for_select( @macros.map { |m| [ m.name, m.id ] } ) 12 | %tr 13 | %td.right= link_to t(:generic_cancel), domain_path( @domain ) 14 | %td= submit_tag t(:label_macro_apply) 15 | -------------------------------------------------------------------------------- /app/views/records/update.js.erb: -------------------------------------------------------------------------------- 1 | <% if resource.errors.empty? %> 2 | $('#show_<%= resource.type.downcase %>_<%= resource.id %>').remove(); 3 | $('#edit_<%= resource.type.downcase %>_<%= resource.id %>').remove(); 4 | $('#marker_<%= resource.type.downcase %>_<%= resource.id %>').replaceWith('<%= escape_javascript render(:partial => '/domains/record', :object => resource) %>'); 5 | humane("<%= escape_javascript t(:message_record_updated) %>"); 6 | <% else %> 7 | humane("<%= escape_javascript t(:message_record_update_fail) %>"); 8 | <% end %> 9 | 10 | -------------------------------------------------------------------------------- /lib/record_patterns.rb: -------------------------------------------------------------------------------- 1 | require 'ipaddr' 2 | 3 | module RecordPatterns 4 | 5 | def hostname?( value ) 6 | value =~ /\A\S+\Z/ 7 | end 8 | 9 | def ip?( value ) 10 | ipv4?( value ) || ipv6?( value ) 11 | end 12 | 13 | def ipv4?( value ) 14 | value =~ /\A(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\z/ 15 | end 16 | 17 | def ipv6?( value ) 18 | begin 19 | IPAddr.new( "[#{value}]" ).ipv6? 20 | rescue ArgumentError 21 | return false 22 | end 23 | end 24 | 25 | end 26 | -------------------------------------------------------------------------------- /app/views/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |<%= f.label :email %>
5 | <%= f.email_field :email %>
<%= f.label :password %>
8 | <%= f.password_field :password %>
<%= f.check_box :remember_me %> <%= f.label :remember_me %>
12 | <% end -%> 13 | 14 |<%= f.submit "Sign in" %>
15 | <% end %> 16 | 17 | <%= render :partial => "devise/shared/links" %> -------------------------------------------------------------------------------- /db/migrate/001_create_domains.rb: -------------------------------------------------------------------------------- 1 | class CreateDomains < ActiveRecord::Migration 2 | def self.up 3 | create_table :domains do |t| 4 | t.string :name 5 | t.string :master 6 | t.integer :last_check 7 | t.string :type, :default => 'NATIVE' 8 | t.integer :notified_serial 9 | t.string :account 10 | t.integer :ttl, :allow_null => false, :default => 86400 11 | 12 | t.timestamps 13 | end 14 | 15 | add_index :domains, :name 16 | end 17 | 18 | def self.down 19 | drop_table :domains 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /spec/controllers/audits_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe AuditsController do 4 | 5 | before(:each) do 6 | sign_in(FactoryGirl.create(:admin)) 7 | end 8 | 9 | it "should have a search form" do 10 | get :index 11 | 12 | response.should render_template('audits/index') 13 | end 14 | 15 | it "should have a domain details page" do 16 | get :domain, :id => FactoryGirl.create(:domain).id 17 | 18 | assigns(:domain).should_not be_nil 19 | 20 | response.should render_template('audits/domain') 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /app/views/record_templates/update.js.erb: -------------------------------------------------------------------------------- 1 | <% if @record_template.errors.empty? %> 2 | $('#show_record_template_<%= @record_template.id %>').remove(); 3 | $('#edit_record_template_<%= @record_template.id %>').remove(); 4 | $('#marker_record_template_<%= @record_template.id %>').replaceWith('<%= escape_javascript render(:partial => '/templates/record_template', :object => @record_template) %>'); 5 | humane("<%= escape_javascript t(:message_record_template_updated) %>"); 6 | <% else %> 7 | humane("<%= escape_javascript t(:message_record_template_update_fail) %>"); 8 | <% end %> 9 | -------------------------------------------------------------------------------- /db/migrate/005_create_roles.rb: -------------------------------------------------------------------------------- 1 | class CreateRoles < ActiveRecord::Migration 2 | def self.up 3 | create_table "roles" do |t| 4 | t.column :name, :string 5 | end 6 | 7 | # generate the join table 8 | create_table "roles_users", :id => false do |t| 9 | t.column "role_id", :integer 10 | t.column "user_id", :integer 11 | end 12 | add_index "roles_users", "role_id" 13 | add_index "roles_users", "user_id" 14 | end 15 | 16 | def self.down 17 | drop_table "roles" 18 | drop_table "roles_users" 19 | end 20 | end -------------------------------------------------------------------------------- /app/models/loc.rb: -------------------------------------------------------------------------------- 1 | # See #LOC 2 | 3 | # = Name Server Record (LOC) 4 | # 5 | # In the Domain Name System, a LOC record (RFC 1876) is a means for expressing 6 | # geographic location information for a domain name. 7 | # It contains WGS84 Latitude, Longitude and Altitude information together with 8 | # host/subnet physical size and location accuracy. This information can be 9 | # queried by other computers connected to the Internet. 10 | # 11 | # Obtained from http://en.wikipedia.org/wiki/LOC_record 12 | # 13 | class LOC < Record 14 | 15 | validates_presence_of :content 16 | 17 | end 18 | -------------------------------------------------------------------------------- /app/models/mx.rb: -------------------------------------------------------------------------------- 1 | # See #MX 2 | 3 | # = Mail Exchange Record (MX) 4 | # Defined in RFC 1035. Specifies the name and relative preference of mail 5 | # servers (mail exchangers in the DNS jargon) for the zone. 6 | # 7 | # Obtained from http://www.zytrax.com/books/dns/ch8/mx.html 8 | # 9 | class MX < Record 10 | 11 | validates_numericality_of :prio, 12 | :greater_than_or_equal_to => 0, 13 | :less_than_or_equal_to => 65535, 14 | :only_integer => true 15 | 16 | validates :content, :presence => true, :hostname => true 17 | 18 | def supports_prio? 19 | true 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /spec/helpers/application_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe ApplicationHelper do 4 | describe "link_to_cancel" do 5 | it "on new records should link to index" do 6 | html = helper.link_to_cancel( Macro.new ) 7 | html.should have_tag('a[href="/macros"]', :content => 'Cancel') 8 | end 9 | 10 | it "on existing records should link to show" do 11 | macro = FactoryGirl.create(:macro) 12 | html = helper.link_to_cancel( macro ) 13 | html.should have_tag("a[href='/macros/#{macro.id}']", :content => 'Cancel') 14 | end 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 |<%= f.label :email %>
7 | <%= f.email_field :email %>
<%= f.label :password %>
10 | <%= f.password_field :password %>
<%= f.label :password_confirmation %>
13 | <%= f.password_field :password_confirmation %>
<%= f.submit "Sign up" %>
16 | <% end %> 17 | 18 | <%= render :partial => "devise/shared/links" %> 19 | -------------------------------------------------------------------------------- /app/views/domains/index.html.haml: -------------------------------------------------------------------------------- 1 | %div{ :style => "display: none" } 2 | #new-zone= t :help_adds_new_domain 3 | #delete-zone= t :help_delete_domain 4 | #zone-edit=t :help_zone_edit 5 | #delete-zone=t :help_delete_zone 6 | #audits=t :help_audits 7 | #macro=t :help_macro 8 | 9 | %ul.start 10 | %li 11 | = link_to info_icon('database_add.png', 'new-zone'), new_domain_path 12 | = link_to t(:label_add_new_zone), new_domain_path 13 | 14 | %h1.underline= t :title_domains_list 15 | 16 | %table 17 | = render :partial => 'domain', :collection => @domains 18 | 19 | = will_paginate @domains 20 | -------------------------------------------------------------------------------- /app/views/templates/index.html.haml: -------------------------------------------------------------------------------- 1 | %h1.underline Zone Templates 2 | 3 | %div{ :style => "display: none;" } 4 | #new-template= t :help_template_zone_new 5 | #edit-template= t :help_template_zone_edit 6 | #delete-template= t :help_template_zone_delete 7 | #missing-soa= t :help_template_zone_soa_missing 8 | 9 | %table.grid 10 | %tr 11 | %td 12 | = link_to info_icon('table_add.png', 'new-template'), new_zone_template_path 13 | = link_to t(:label_template_create_new), new_zone_template_path 14 | %td 15 | = render :partial => 'zone_template', :collection => @zone_templates 16 | -------------------------------------------------------------------------------- /app/models/txt.rb: -------------------------------------------------------------------------------- 1 | # See #TXT 2 | 3 | # = Text Record (TXT) 4 | # Provides the ability to associate some text with a host or other name. The TXT 5 | # record is used to define the Sender Policy Framework (SPF) information record 6 | # which may be used to validate legitimate email sources from a domain. The SPF 7 | # record while being increasing deployed is not (July 2004) a formal IETF RFC 8 | # standard. 9 | # 10 | # Obtained from http://www.zytrax.com/books/dns/ch8/txt.html 11 | class TXT < Record 12 | 13 | validates :content, format: { with: /\A".*"\Z/, message: "TXT records must be in quotes" } 14 | 15 | end 16 | -------------------------------------------------------------------------------- /app/models/a.rb: -------------------------------------------------------------------------------- 1 | # See #A 2 | 3 | # = IPv4 Address Record (A) 4 | # 5 | # Defined in RFC 1035. Forward maps a host name to IPv4 address. The only 6 | # parameter is an IP address in dotted decimal format. The IP address in not 7 | # terminated with a '.' (dot). Valid host name format (a.k.a 'label' in DNS 8 | # jargon). If host name is BLANK (or space) then the last valid name (or label) 9 | # is substituted. 10 | # 11 | # Obtained from http://www.zytrax.com/books/dns/ch8/a.html 12 | # 13 | class A < Record 14 | 15 | # Only accept valid IPv4 addresses 16 | validates :content, :presence => true, :ip_address => true 17 | 18 | end 19 | -------------------------------------------------------------------------------- /app/controllers/templates_controller.rb: -------------------------------------------------------------------------------- 1 | class TemplatesController < InheritedResources::Base 2 | 3 | defaults :resource_class => ZoneTemplate, :collection_name => 'zone_templates', :instance_name => 'zone_template' 4 | respond_to :html, :xml, :json 5 | 6 | protected 7 | 8 | def collection 9 | @zone_templates = ZoneTemplate.user(current_user).all 10 | end 11 | 12 | public 13 | 14 | def create 15 | @zone_template = ZoneTemplate.new(params[:zone_template]) 16 | @zone_template.user = current_user unless current_user.admin? 17 | 18 | create! { zone_template_path( @zone_template ) } 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /spec/views/macros/index.html.haml_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe "macros/index.html.haml" do 4 | 5 | it "should render a list of macros" do 6 | 2.times { |i| FactoryGirl.create(:macro, :name => "Macro #{i}") } 7 | assign(:macros, Macro.all) 8 | 9 | render 10 | 11 | rendered.should have_tag('h1', :content => 'Macros') 12 | render.should have_tag("table a[href^='/macro']") 13 | end 14 | 15 | it "should indicate no macros are present" do 16 | assign(:macros, Macro.all) 17 | 18 | render 19 | 20 | rendered.should have_tag('em', :content => "don't have any macros") 21 | end 22 | 23 | end 24 | -------------------------------------------------------------------------------- /app/views/devise/passwords/edit.html.erb: -------------------------------------------------------------------------------- 1 |<%= f.label :password, "New password" %>
8 | <%= f.password_field :password %>
<%= f.label :password_confirmation, "Confirm new password" %>
11 | <%= f.password_field :password_confirmation %>
<%= f.submit "Change my password" %>
14 | <% end %> 15 | 16 | <%= render :partial => "devise/shared/links" %> -------------------------------------------------------------------------------- /spec/factories/macro_factory.rb: -------------------------------------------------------------------------------- 1 | FactoryGirl.define do 2 | 3 | factory :macro do 4 | name 'Move to West Coast' 5 | active true 6 | end 7 | 8 | factory :macro_step_create, :class => MacroStep do 9 | action 'create' 10 | record_type 'A' 11 | name 'auto' 12 | content '127.0.0.1' 13 | end 14 | 15 | factory :macro_step_change, :class => MacroStep do 16 | action 'update' 17 | record_type 'A' 18 | name 'www' 19 | content '127.1.1.1' 20 | end 21 | 22 | factory :macro_step_remove, :class => MacroStep do 23 | action 'remove' 24 | record_type 'A' 25 | name 'ftp' 26 | end 27 | 28 | end 29 | 30 | -------------------------------------------------------------------------------- /app/views/record_templates/create.js.erb: -------------------------------------------------------------------------------- 1 | $('#record-form div.errorExplanation').remove(); 2 | 3 | <% if !@record_template.new_record? %> 4 | $('#record-form-div').hide(); 5 | $('#record-form input:text').val(''); 6 | $('#record-table').append('<%= escape_javascript render(:partial => '/templates/record_template', :object => @record_template) %>'); 7 | humane('<%= escape_javascript t(:message_record_template_created) %>'); 8 | 9 | <% if @record_template.record_type == 'SOA' %> 10 | $('#soa-warning').hide(); 11 | <% end %> 12 | <% else %> 13 | $('#record-form').prepend('<%= escape_javascript error_messages_for(@record_template) %>'); 14 | <% end %> 15 | -------------------------------------------------------------------------------- /app/models/spf.rb: -------------------------------------------------------------------------------- 1 | # See #SPF 2 | 3 | # = Text Record (SPF) 4 | # 5 | # In computing, Sender Policy Framework (SPF) allows software to identify 6 | # messages that are or are not authorized to use the domain name in the SMTP 7 | # HELO and MAIL FROM (Return-Path) commands, based on information published in a 8 | # sender policy of the domain owner. Forged return paths are common in e-mail 9 | # spam and result in backscatter. SPF is defined in RFC 4408 10 | # 11 | # Obtained from http://en.wikipedia.org/wiki/Sender_Policy_Framework 12 | # 13 | class SPF < Record 14 | 15 | validates :content, format: { with: /\A".*"\Z/, message: "SPF records must be in quotes" } 16 | 17 | end 18 | -------------------------------------------------------------------------------- /app/models/aaaa.rb: -------------------------------------------------------------------------------- 1 | # See #AAAA 2 | 3 | # = IPv6 Address Record (AAAA) 4 | # 5 | # The current IETF recommendation is to use AAAA (Quad A) RR for forward mapping 6 | # and PTR RRs for reverse mapping when defining IPv6 networks. The IPv6 AAAA RR 7 | # is defined in RFC 3596. RFC 3363 changed the status of the A6 RR (defined in 8 | # RFC 2874 from a PROPOSED STANDARD to EXPERIMENTAL due primarily to performance 9 | # and operational concerns. 10 | # 11 | # Obtained from http://www.zytrax.com/books/dns/ch8/aaaa.html 12 | # 13 | class AAAA < Record 14 | 15 | # Only accept valid IPv6 addresses 16 | validates :content, :presence => true, :ip_address => { :ipv6 => true } 17 | 18 | end 19 | -------------------------------------------------------------------------------- /db/migrate/002_create_records.rb: -------------------------------------------------------------------------------- 1 | class CreateRecords < ActiveRecord::Migration 2 | def self.up 3 | create_table :records do |t| 4 | t.integer :domain_id, :null => false 5 | t.string :name, :null => false 6 | t.string :type, :null => false 7 | t.string :content, :null => false 8 | t.integer :ttl, :null => false 9 | t.integer :prio 10 | t.integer :change_date, :null => true 11 | 12 | t.timestamps :null => true 13 | end 14 | 15 | add_index :records, :domain_id 16 | add_index :records, :name 17 | add_index :records, [ :name, :type ] 18 | end 19 | 20 | def self.down 21 | drop_table :records 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /app/models/user_mailer.rb: -------------------------------------------------------------------------------- 1 | class UserMailer < ActionMailer::Base 2 | def signup_notification(user) 3 | setup_email(user) 4 | @subject += I18n.t(:message_user_activate_account) 5 | 6 | @body[:url] = "http://YOURSITE/activate/#{user.activation_code}" 7 | 8 | end 9 | 10 | def activation(user) 11 | setup_email(user) 12 | @subject += I18n.t(:message_user_activated) 13 | @body[:url] = "http://YOURSITE/" 14 | end 15 | 16 | protected 17 | def setup_email(user) 18 | @recipients = "#{user.email}" 19 | @from = "ADMINEMAIL" 20 | @subject = "[YOURSITE] " 21 | @sent_on = Time.now 22 | @body[:user] = user 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /app/controllers/reports_controller.rb: -------------------------------------------------------------------------------- 1 | class ReportsController < ApplicationController 2 | 3 | before_filter do 4 | unless current_user.admin? 5 | redirect_to root_url 6 | end 7 | end 8 | 9 | # search for a specific user 10 | def index 11 | @users = User.where(:admin => false).paginate(:page => params[:page]) 12 | @total_domains = Domain.count 13 | @system_domains = Domain.where('user_id IS NULL').count 14 | end 15 | 16 | def results 17 | if params[:q].chomp.blank? 18 | redirect_to reports_path 19 | else 20 | @results = User.search(params[:q], params[:page]) 21 | end 22 | end 23 | 24 | def view 25 | @user = User.find(params[:id]) 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | class UsersController < InheritedResources::Base 2 | 3 | before_filter do 4 | unless current_user.admin? 5 | redirect_to root_url 6 | end 7 | end 8 | 9 | def update 10 | # strip out blank params 11 | params[:user].delete_if { |k,v| v.blank? } 12 | update! 13 | end 14 | 15 | def suspend 16 | resource.suspend! 17 | redirect_to users_path 18 | end 19 | 20 | def unsuspend 21 | resource.unsuspend! 22 | redirect_to users_path 23 | end 24 | 25 | def destroy 26 | resource.delete! 27 | redirect_to users_path 28 | end 29 | 30 | def purge 31 | resource.destroy 32 | redirect_to users_path 33 | end 34 | 35 | end 36 | -------------------------------------------------------------------------------- /app/models/srv.rb: -------------------------------------------------------------------------------- 1 | # See #SRV 2 | 3 | # = Service Record (SRV) 4 | # 5 | # An SRV record or Service record is a category of data in the Internet Domain 6 | # Name System specifying information on available services. It is defined in 7 | # RFC 2782. Newer internet protocols such as SIP and XMPP often require SRV 8 | # support from clients. 9 | # 10 | # Obtained from http://en.wikipedia.org/wiki/SRV_record 11 | # 12 | # See also http://www.zytrax.com/books/dns/ch8/srv.html 13 | # 14 | class SRV < Record 15 | 16 | validates_numericality_of :prio, 17 | :greater_than_or_equal_to => 0 18 | 19 | validates_presence_of :content 20 | 21 | # We support priorities 22 | def supports_prio? 23 | true 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /db/migrate/003_create_templates.rb: -------------------------------------------------------------------------------- 1 | class CreateTemplates < ActiveRecord::Migration 2 | def self.up 3 | create_table :zone_templates do |t| 4 | t.string :name 5 | t.integer :ttl, :allow_null => false, :default => 86400 6 | 7 | t.timestamps 8 | end 9 | 10 | create_table :record_templates do |t| 11 | t.integer :zone_template_id 12 | t.string :name 13 | t.string :record_type, :null => false 14 | t.string :content, :null => false 15 | t.integer :ttl, :null => false 16 | t.integer :prio 17 | 18 | t.timestamps 19 | end 20 | end 21 | 22 | def self.down 23 | drop_table :zone_templates 24 | drop_table :record_templates 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /db/migrate/20081228121040_create_macros.rb: -------------------------------------------------------------------------------- 1 | class CreateMacros < ActiveRecord::Migration 2 | def self.up 3 | create_table :macros do |t| 4 | t.string :name, :description 5 | t.references :user 6 | t.boolean :active, :default => false 7 | 8 | t.timestamps 9 | end 10 | 11 | create_table :macro_steps do |t| 12 | t.references :macro 13 | t.string :action, :record_type, :name, :content 14 | t.integer :ttl, :prio, :position 15 | t.boolean :active, :default => true 16 | t.string :note 17 | 18 | t.timestamps 19 | end 20 | 21 | end 22 | 23 | def self.down 24 | drop_table :macros 25 | drop_table :macro_steps 26 | end 27 | end 28 | 29 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | 3 | bundler_args: --without development 4 | 5 | rvm: 6 | - 2.2 7 | - 2.1 8 | - 2.0 9 | - rbx-19mode 10 | - 1.9.3 11 | - 1.9.2 12 | 13 | env: 14 | - DB=sqlite 15 | - DB=mysql 16 | - DB=postgresql 17 | 18 | before_script: 19 | - mv config/database.yml.template config/database.yml 20 | - rake generate_secret_token 21 | - mysql -e 'create database powerdns_test;' 22 | - psql -c 'create database powerdns_test;' -U postgres 23 | - bundle exec rake db:migrate 24 | - bundle exec rake db:seed 25 | 26 | script: "bundle exec rake spec" 27 | 28 | matrix: 29 | allow_failures: 30 | - rvm: 2.2 31 | - rvm: jruby-19mode 32 | - rvm: rbx-19mode 33 | - env: DB=sqlite 34 | 35 | sudo: false 36 | -------------------------------------------------------------------------------- /app/controllers/search_controller.rb: -------------------------------------------------------------------------------- 1 | class SearchController < ApplicationController 2 | 3 | def results 4 | if params[:q].chomp.blank? 5 | respond_to do |format| 6 | format.html { redirect_to root_path } 7 | format.json { render :status => 404, :json => { :error => "Missing 'q' parameter" } } 8 | end 9 | else 10 | @results = Domain.search(params[:q], params[:page], current_user) 11 | 12 | respond_to do |format| 13 | format.html do 14 | if @results.size == 1 15 | redirect_to domain_path(@results.pop) 16 | end 17 | end 18 | format.json do 19 | render :json => @results.to_json(:only => [:id, :name]) 20 | end 21 | end 22 | end 23 | end 24 | 25 | end 26 | -------------------------------------------------------------------------------- /app/views/domains/_domain.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td 3 | = link_to domain.name, domain_path( domain ) 4 | %td 5 | %td 6 | = link_to info_icon('table_edit.png', 'zone-edit'), edit_domain_path(domain) 7 | = link_to info_icon('report_magnify.png', 'audits'), audits_path(:action => :domain, :id => domain) 8 | - unless domain.slave? 9 | = link_to info_icon('brick_go.png', 'macro'), apply_macro_domain_path( domain ) 10 | - if current_user.admin? && domain.user 11 | = link_to_function info_icon('database_delete.png', 'delete-zone'), "deleteDomain();" , :id => "delete-link-buffer" 12 | - elsif !current_token 13 | = link_to info_icon('database_delete.png', 'delete-zone'), domain_path( domain ), :method => :delete, :confirm => t(:confirm_domain_delete, :domain => domain.name) 14 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |Maybe you tried to change something you didn't have access to.
24 |You may have mistyped the address or the page may have moved.
24 |We've been notified about this issue and we'll take a look at it shortly.
24 |<%= f.label :email %>
7 | <%= f.email_field :email %>
<%= f.label :password %> (leave blank if you don't want to change it)
10 | <%= f.password_field :password %>
<%= f.label :password_confirmation %>
13 | <%= f.password_field :password_confirmation %>
<%= f.label :current_password %> (we need your current password to confirm your changes)
16 | <%= f.password_field :current_password %>
<%= f.submit "Update" %>
19 | <% end %> 20 | 21 |Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.
24 | 25 | <%= link_to "Back", :back %> 26 | -------------------------------------------------------------------------------- /app/views/templates/_form.html.haml: -------------------------------------------------------------------------------- 1 | %div{:style => "display: none;"} 2 | #zone-name= t :help_template_name 3 | #zone-ttl 4 | 5 | = form_for( @zone_template ) do |f| 6 | = error_messages_for :zone_template 7 | %table 8 | %tr 9 | %td= t :label_template_zone_name 10 | %td 11 | %td= f.text_field :name 12 | %tr 13 | %td= t :label_template_zone_ttl 14 | %td 15 | %td= f.text_field :ttl, :size => 6 16 | %tr 17 | %td= t :label_template_zone_type 18 | %td 19 | %td= f.select :type, ['NATIVE','MASTER','SLAVE'] 20 | %tr 21 | %td= t :label_template_zone_master 22 | %td 23 | %td= f.text_field :master, :size => 15 24 | - if User.active_owners.any? 25 | %tr 26 | %td= t :label_template_zone_owner 27 | %td 28 | %td= f.collection_select :user_id, User.active_owners, :id, :login, :include_blank => true 29 | %tr 30 | %td= link_to_cancel @zone_template 31 | %td= submit_tag t(:generic_save) 32 | -------------------------------------------------------------------------------- /TODO.textile: -------------------------------------------------------------------------------- 1 | h1. PowerDNS on Rails TODO 2 | 3 | Simple list of things to do by version. This is not authorative, the real list will be maintained at the LightHouse tracker. 4 | 5 | http://kennethkalmer.lighthouseapp.com/projects/11831-powerdns-on-rails/ 6 | 7 | h2. Not Started / In Progress 8 | 9 | * Multiple users (admins or owners) 10 | (remove roles model and persist roles in users table) 11 | * Solid models and model specs 12 | * Documentation (becoming urgent) 13 | * Configuration samples for powerdns 14 | * Basic API client 15 | * DNS Insights 16 | * API improvements 17 | * Deployment instructions directly from GitHub 18 | * mod_passenger installation 19 | * simple git clone and future git pull's 20 | * Import scripts for standard zone files and PowerDNS 21 | * Flexible model support? 22 | * Statistics (import pdns logs) 23 | 24 | h2. Completed 25 | 26 | * Github project page 27 | * Configurable macros 28 | * Basic database structure 29 | * Zone/Record Templates 30 | * Authentication tokens for one-time access 31 | * User management 32 | -------------------------------------------------------------------------------- /app/views/reports/index.html.haml: -------------------------------------------------------------------------------- 1 | %h2.underline= t :title_user_reports 2 | 3 | #search-user-bar.padded 4 | - form_tag( { :controller => :reports, :action => :results }, { :method => :get } ) do 5 | = text_field_tag :q 6 | = submit_tag t(:label_user_search) 7 | 8 | #users.padded 9 | %table.grid 10 | %tr 11 | %th.left= t :label_user_login 12 | %th.right= t :label_user_domains 13 | %th.left= t :label_user_email 14 | - if @users 15 | = render :partial => 'user', :collection => @users 16 | - else 17 | %tr 18 | %td 19 | %em= t :message_user_no_domains 20 | %td.right 0 21 | %td - 22 | %tr 23 | %td{ :colspan => 3 } 24 | %tr 25 | %td 26 | %em= t :label_report_system_domains 27 | %td.right= @system_domains 28 | %td 29 | %tr 30 | %td 31 | %em= t :label_report_total_domains 32 | %td.right= @total_domains 33 | %td 34 | 35 | = will_paginate @users if @users 36 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | 3 | gem 'rails', '~> 3.2.21' 4 | 5 | group :assets do 6 | gem 'sass-rails' 7 | gem 'coffee-rails' 8 | gem 'uglifier' 9 | end 10 | 11 | platforms :ruby do 12 | gem 'mysql2', '~> 0.3.11' 13 | gem 'pg', '>= 0.9.0' 14 | gem 'sqlite3' 15 | gem 'therubyracer' 16 | end 17 | 18 | gem 'haml-rails' 19 | gem 'jquery-rails' 20 | gem 'will_paginate', '~> 3.0.4' 21 | gem "audited-activerecord", "~> 3.0.0.rc2" 22 | gem 'inherited_resources' 23 | gem 'devise', '~> 2.2.8' 24 | gem "devise-encryptable" 25 | gem 'rabl' 26 | gem 'state_machine' 27 | 28 | gem 'acts_as_list' 29 | gem 'dynamic_form' 30 | 31 | group :development do 32 | gem 'debugger', :platform => :mri_19 33 | #gem 'RedCloth', '>= 4.1.1' 34 | end 35 | 36 | group :development, :test do 37 | gem "rspec-rails" 38 | gem 'RedCloth', '>= 4.1.1' 39 | end 40 | 41 | group :test do 42 | gem "factory_girl_rails", "~> 4.0" 43 | 44 | gem "cucumber-rails", :require => false 45 | gem 'mocha', :require => false 46 | gem 'webrat' 47 | gem 'database_cleaner' 48 | end 49 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 Kenneth Kalmer 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /features/support/selectors.rb: -------------------------------------------------------------------------------- 1 | module HtmlSelectorsHelpers 2 | # Maps a name to a selector. Used primarily by the 3 | # 4 | # When /^(.+) within (.+)$/ do |step, scope| 5 | # 6 | # step definitions in web_steps.rb 7 | # 8 | def selector_for(locator) 9 | case locator 10 | 11 | when "the page" 12 | "html > body" 13 | 14 | # Add more mappings here. 15 | # Here is an example that pulls values out of the Regexp: 16 | # 17 | # when /^the (notice|error|info) flash$/ 18 | # ".flash.#{$1}" 19 | 20 | # You can also return an array to use a different selector 21 | # type, like: 22 | # 23 | # when /the header/ 24 | # [:xpath, "//header"] 25 | 26 | # This allows you to provide a quoted selector as the scope 27 | # for "within" steps as was previously the default for the 28 | # web steps: 29 | when /^"(.+)"$/ 30 | $1 31 | 32 | else 33 | raise "Can't find mapping from \"#{locator}\" to a selector.\n" + 34 | "Now, go and add a mapping in #{__FILE__}" 35 | end 36 | end 37 | end 38 | 39 | World(HtmlSelectorsHelpers) 40 | -------------------------------------------------------------------------------- /spec/views/reports/results.html.haml_spec: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../../spec_helper' 2 | 3 | describe "/reports/results" do 4 | 5 | before(:each) do 6 | @admin = FactoryGirl.create(:admin) 7 | end 8 | 9 | it "should handle no results" do 10 | assigns[:results] = [] 11 | 12 | render "/reports/results" 13 | 14 | response.should have_tag("strong", "No users found") 15 | end 16 | 17 | it "should handle results within the pagination limit" do 18 | assigns[:results] = User.search( 'a', 1 ) 19 | 20 | render "/reports/results" 21 | 22 | response.should have_tag("table") do 23 | with_tag "a", "admin" 24 | end 25 | end 26 | 27 | it "should handle results with pagination and scoping" do 28 | 1.upto(100) do |i| 29 | user = User.new 30 | user.login = "test-user-#{i}" 31 | user.save( false ).should be_true 32 | end 33 | 34 | assigns[:results] = User.search( 'test-user', 1 ) 35 | 36 | render "/reports/results" 37 | 38 | response.should have_tag("table") do 39 | with_tag "a", "test-user-1" 40 | end 41 | end 42 | 43 | end 44 | -------------------------------------------------------------------------------- /app/views/macros/edit.html.haml: -------------------------------------------------------------------------------- 1 | %h1.underline 2 | = @macro.new_record? ? t(:title_macro_new) : t(:title_macro_update) 3 | 4 | %div{ :style => "display:none" } 5 | #macro-name= t :help_macro_name 6 | #macro-active= t :help_macro_active 7 | 8 | = form_for( @macro ) do |f| 9 | = error_messages_for :macro 10 | 11 | %table 12 | %tr 13 | %td= t(:label_macro_name) 14 | %td 15 | %td 16 | = f.text_field :name 17 | = help_icon('macro-name') 18 | %tr 19 | %td.top= t(:label_macro_description) 20 | %td 21 | %td= f.text_area :description, :size => '35x2' 22 | - if current_user.admin? && !possible_owners.empty? 23 | %tr 24 | %td= t(:label_macro_owner) 25 | %td 26 | %td= f.collection_select :user_id, possible_owners, :id, :login, :include_blank => true 27 | %tr 28 | %td= t(:label_macro_active) 29 | %td 30 | %td 31 | = f.check_box :active 32 | = help_icon('macro-active') 33 | %tr 34 | %td.right= link_to_cancel @macro 35 | %td 36 | %td= submit_tag t(:generic_save) 37 | -------------------------------------------------------------------------------- /spec/views/macros/edit.html.haml_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe "macros/edit.html.haml" do 4 | before(:each) do 5 | admin = FactoryGirl.build_stubbed( :admin ) 6 | view.stub( :current_user ).and_return( admin ) 7 | end 8 | 9 | context "for new macros" do 10 | before(:each) do 11 | assign(:macro, Macro.new) 12 | render 13 | end 14 | 15 | it "should behave accordingly" do 16 | rendered.should have_tag('h1', :content => 'New Macro') 17 | end 18 | 19 | end 20 | 21 | context "for existing records" do 22 | before(:each) do 23 | @macro = FactoryGirl.create(:macro) 24 | assign(:macro, @macro) 25 | render 26 | end 27 | 28 | it "should behave accordingly" do 29 | rendered.should have_tag('h1', :content => 'Update Macro') 30 | end 31 | end 32 | 33 | describe "for records with errors" do 34 | before(:each) do 35 | m = Macro.new 36 | m.valid? 37 | assign(:macro, m) 38 | render 39 | end 40 | 41 | it "should display the errors" do 42 | rendered.should have_tag('div.errorExplanation') 43 | end 44 | end 45 | 46 | end 47 | -------------------------------------------------------------------------------- /app/views/domains/edit.html.haml: -------------------------------------------------------------------------------- 1 | %h1.underline=t :title_update_zone 2 | 3 | / These divs contain the help information. 4 | %div{ :style => 'display: none' } 5 | #help-domain=t :help_domain_fqdn 6 | #help-type=t :help_domain_type 7 | #help-master=t :help_domain_master 8 | #help-ttl=t :help_ttl 9 | 10 | = form_for(@domain) do |f| 11 | = error_messages_for :domain 12 | %p 13 | %table.grid 14 | %tr 15 | %td{:width => "300"}=t :label_domain_name 16 | %td= f.text_field :name 17 | %td= help_icon('help-domain') 18 | %tr 19 | %td= t :label_domain_type 20 | %td 21 | = f.select :type, ['NATIVE','MASTER','SLAVE'] 22 | %td= help_icon('help-type') 23 | %tr#master-address{ :style => 'display: none' } 24 | %td= t :label_domain_master_address 25 | %td= f.text_field :master 26 | %td= help_icon('help-master') 27 | %tr 28 | %td= t :label_default_ttl 29 | %td= f.text_field :ttl, :size => 8 30 | %td= help_icon('help-ttl') 31 | %table.grid 32 | %tr 33 | %td.right{:width => "300"}= link_to_cancel @domain 34 | %td= submit_tag t(:generic_save) 35 | %td 36 | 37 | -------------------------------------------------------------------------------- /config/database.yml.template: -------------------------------------------------------------------------------- 1 | # You'll need to configure this file for the appropriate environment before 2 | # you run PowerDNS on Rails. 3 | 4 | sqlite: &sqlite 5 | adapter: sqlite3 6 | database: db/<%= Rails.env %>.sqlite3 7 | 8 | mysql: &mysql 9 | adapter: mysql2 10 | username: root 11 | password: 12 | database: powerdns_<%= Rails.env %> 13 | encoding: utf8 14 | 15 | postgresql: &postgresql 16 | adapter: postgresql 17 | encoding: unicode 18 | username: postgres 19 | password: 20 | database: powerdns_<%= Rails.env %> 21 | min_messages: ERROR 22 | 23 | defaults: &defaults 24 | pool: 16 25 | timeout: 5000 26 | host: localhost 27 | <<: *<%= ENV['DB'] || "mysql" %> 28 | 29 | # Development, defaults to MySQL 30 | development: 31 | <<: *defaults 32 | 33 | # Warning: The database defined as 'test' will be erased and 34 | # re-generated from your development database when you run 'rake'. 35 | # Do not set this db to the same as development or production. 36 | test: 37 | <<: *defaults 38 | 39 | production: 40 | adapter: mysql2 41 | database: powerdns_production 42 | host: localhost 43 | username: root 44 | password: dont-use-root-here 45 | 46 | -------------------------------------------------------------------------------- /spec/factories/zone_template_factory.rb: -------------------------------------------------------------------------------- 1 | FactoryGirl.define do 2 | 3 | factory :zone_template, :class => ZoneTemplate do 4 | name 'East Coast Data Center' 5 | ttl 86400 6 | end 7 | 8 | factory :template_soa, :class => RecordTemplate do 9 | ttl 86400 10 | record_type 'SOA' 11 | #content 'ns1.%ZONE% admin@%ZONE% 0 10800 7200 604800 3600' 12 | primary_ns 'ns1.%ZONE%' 13 | contact 'admin@%ZONE%' 14 | refresh 10800 15 | self.retry 7200 16 | expire 604800 17 | minimum 3600 18 | end 19 | 20 | factory :template_ns, :class => RecordTemplate do 21 | ttl 86400 22 | record_type 'NS' 23 | content 'ns1.%ZONE%' 24 | end 25 | 26 | factory :template_ns_a, :class => RecordTemplate do 27 | ttl 86400 28 | record_type 'A' 29 | name 'ns1.%ZONE%' 30 | content '10.0.0.1' 31 | end 32 | 33 | factory :template_cname, :class => RecordTemplate do 34 | ttl 86400 35 | record_type 'CNAME' 36 | name '%ZONE%' 37 | content 'some.cname.org' 38 | end 39 | 40 | factory :template_mx, :class => RecordTemplate do 41 | ttl 86400 42 | record_type 'MX' 43 | content 'mail.%ZONE%' 44 | prio 10 45 | end 46 | 47 | end 48 | -------------------------------------------------------------------------------- /app/views/users/show.html.haml: -------------------------------------------------------------------------------- 1 | %h1.underline 2 | = t(:title_user_detail_for, :user => @user.login) 3 | 4 | %table.grid 5 | %tr 6 | %td= t :label_user_name 7 | %td= @user.login 8 | %tr 9 | %td= t :label_user_email 10 | %td= @user.email 11 | %tr 12 | %td= t :label_user_admin 13 | %td= @user.admin? ? 'Yes' : 'No' 14 | %tr 15 | %td= t :label_user_auth_tokens 16 | %td= @user.auth_tokens? ? 'Yes' : 'No' 17 | %tr 18 | %td 19 | %td 20 | %tr 21 | %td 22 | %td 23 | = link_to image_tag('user_edit.png'), edit_user_path( @user ) 24 | = link_to t(:generic_change), edit_user_path( @user ) 25 | 26 | = link_to image_tag('user_delete.png'), user_path( @user ), :method => :delete, :confirm => t(:confirm_user_remove) 27 | = link_to t(:generic_remove), user_path( @user ), :method => :delete, :confirm => t(:confirm_user_remove) 28 | - unless @user.admin? 29 | 30 | = link_to image_tag('help.png') , :controller => :reports , :action => :view , :id => @user 31 | = link_to t(:label_user_detail) , :controller => :reports , :action => :view , :id => @user 32 | -------------------------------------------------------------------------------- /spec/controllers/sessions_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe SessionsController, "and auth tokens" do 4 | 5 | before(:each) do 6 | @domain = FactoryGirl.create(:domain) 7 | @user = FactoryGirl.create(:admin) 8 | @token = FactoryGirl.create(:auth_token, :domain => @domain, :user => @user) 9 | end 10 | 11 | xit 'accepts and redirects' do 12 | post :token, :token => '5zuld3g9dv76yosy' 13 | session[:token_id].should_not be_nil 14 | controller.send(:token_user?).should be_true 15 | response.should be_redirect 16 | response.should redirect_to( domain_path( @domain ) ) 17 | end 18 | 19 | xit 'fails login and does not redirect' do 20 | post :token, :token => 'bad_token' 21 | session[:token_id].should be_nil 22 | response.should be_success 23 | end 24 | 25 | xit 'logs out' do 26 | tokenize_as(@token) 27 | get :destroy 28 | session[:token_id].should be_nil 29 | response.should redirect_to( session_path ) 30 | end 31 | 32 | xit 'fails expired cookie login' do 33 | @token.update_attribute :expires_at, 5.minutes.ago 34 | get :new 35 | controller.send(:token_user?).should_not be_true 36 | end 37 | 38 | end 39 | -------------------------------------------------------------------------------- /app/views/devise/shared/_links.erb: -------------------------------------------------------------------------------- 1 | <%- if controller_name != 'sessions' %> 2 | <%= link_to "Sign in", new_session_path(resource_name) %>
Processing