This repository has been archived by the owner on Mar 5, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* some extensions to acts_as_audited * don't audit SOA serial number changes * keep full record details when records are destroy * basic view of domain history Other spec improvements and new pendings Minor style tweaks
- Loading branch information
1 parent
8a26e0b
commit 7066b3c
Showing
20 changed files
with
198 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class AuditsController < ApplicationController | ||
|
||
require_role "admin" | ||
|
||
def index | ||
|
||
end | ||
|
||
# Retrieve the audit details for a domain | ||
def domain | ||
@domain = Domain.find( | ||
params[:id], | ||
:user => current_user | ||
) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module AuditsHelper | ||
|
||
def parenthesize( text ) | ||
"(#{text})" | ||
end | ||
|
||
def link_to_domain_audit( audit ) | ||
caption = "#{audit.version} #{audit.action} by " | ||
caption << (audit.user ? audit.user.login : audit.username) | ||
link_to_function caption, "toggleDomainAudit(#{audit.id})" | ||
end | ||
|
||
def link_to_record_audit( audit ) | ||
caption = audit.changes['type'] | ||
caption += " (#{audit.changes['name']})" unless audit.changes['name'].nil? | ||
caption += " #{audit.version} #{audit.action} by " | ||
caption += (audit.user ? audit.user.login : audit.username) | ||
link_to_function caption, "toggleRecordAudit(#{audit.id})" | ||
end | ||
|
||
def display_hash( hash ) | ||
hash.map { |k,v| v ? "<em>#{k}</em>: #{v}" : nil }.compact.join('<br />') | ||
end | ||
|
||
def sort_audits_by_date( collection ) | ||
collection.sort_by(&:created_at).reverse | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,7 +118,7 @@ def admin=( value ) | |
value | ||
end | ||
end | ||
|
||
protected | ||
# before filter | ||
def encrypt_password | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
%li | ||
= link_to_domain_audit( domain_audit ) | ||
%div[ domain_audit ]{ :style => 'display: none' } | ||
%strong Time: | ||
= domain_audit.created_at | ||
%br | ||
%strong Changes: | ||
%br | ||
= display_hash domain_audit.changes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
%li | ||
= link_to_record_audit( record_audit ) | ||
%div[ record_audit ]{ :style => 'display: none' } | ||
%strong Time: | ||
= record_audit.created_at | ||
%br | ||
%strong Changes: | ||
%br | ||
= display_hash record_audit.changes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
%h1.underline | ||
Audit information for | ||
= link_to @domain.name, domain_path(@domain) | ||
|
||
%p | ||
You can click on any revision number on the lists below to see the details | ||
of the revision | ||
|
||
%h2.underline Domain Revisions | ||
|
||
- if @domain.audits.size > 0 | ||
%ul | ||
= render :partial => 'domain_audit', :collection => sort_audits_by_date( @domain.audits ) | ||
- else | ||
%p | ||
%em No revisions found for the domain. | ||
|
||
%h2.underline RR Revisions | ||
|
||
- if @domain.record_audits.size > 0 | ||
%p Revisions below sorted in reverse chronoligical order. | ||
|
||
%ul | ||
= render :partial => 'record_audit', :collection => sort_audits_by_date( @domain.record_audits ) | ||
- else | ||
%p | ||
%em No revisions found for any resource records of the domain. | ||
|
||
:javascript | ||
function toggleDomainAudit(id){ | ||
$('audit_' + id).toggle(); | ||
} | ||
function toggleRecordAudit(id){ | ||
$('audit_' + id).toggle(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
%h1.underline Search audit logs | ||
|
||
%em Coming soon! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,7 @@ body { | |
font-size: 14px; | ||
} | ||
p { | ||
margin: 0; | ||
margin: 5px 0; | ||
} | ||
label { | ||
width: 200px; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require File.dirname(__FILE__) + '/../spec_helper' | ||
|
||
describe AuditsController do | ||
fixtures :users, :domains, :records | ||
|
||
before(:each) do | ||
login_as(:admin) | ||
end | ||
|
||
it "should have a search form" do | ||
get :index | ||
|
||
pending | ||
end | ||
|
||
it "should have a domain details page" do | ||
get :domain, :id => domains(:example_com).id | ||
|
||
assigns[:domain].should_not be_nil | ||
|
||
response.should render_template('domain') | ||
end | ||
end |
Oops, something went wrong.