code
stringlengths
1
1.73M
language
stringclasses
1 value
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class EdgeIDsBetweenTest < Test::Unit::TestCase def test_no_edges_between test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml.pare...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class EdgeLabelBetweenTest < Test::Unit::TestCase def test_no_edges_between test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml.pa...
Ruby
When /^cmap-eval is executed$/ do @output = `ruby src/cmap-eval.rb`.chomp end Then /^it will display "([^"]*)"$/ do |expected_output| @output.should == expected_output end
Ruby
puts "hello world"
Ruby
require "fileutils" INPUT_PATH = "features/input_files/" SANDBOX_PATH = "sandbox/" def input_check file_name relative_file_name = INPUT_PATH + file_name file_check relative_file_name end def file_check full_file_name if !File.readable? full_file_name pending "File #{full_file_name} does not exist!" en...
Ruby
Given /^options of "([^"]*)"$/ do |options| @options = options end Given /^no command-line arguments$/ do # Do nothing; there are no command-line arguments! end Given /^key "([^"]*)" and input "([^"]*)"$/ do |key, input| @key_file_name = INPUT_PATH + key @input_file_name = SANDBOX_PATH + input # ...
Ruby
#TODO: figure out a sane build mechanism. require "src/c_map" require "src/debug" require "src/output" require "rubygems" require "nokogiri" # TODO: this needs significant cleanup. def check_inputs args key_file_name = nil input_file_name = nil if args.size == 0 or args.size > 3 Output.wr...
Ruby
module Debug def Debug.enable_debug @enabled = true end def Debug.no_missing_edges debug "There are no missing edges." end def Debug.missing_edge_between node1, node2 debug %{Missing edge between: "#{node1}" and "#{node2}"} end def Debug.misplaced_edge_between node1, node2, edge deb...
Ruby
module CMap CONCEPT_XPATH = "/xmlns:cmap/xmlns:map/xmlns:concept-list/xmlns:concept" CONNECTION_XPATH = "/xmlns:cmap/xmlns:map/xmlns:connection-list/xmlns:connection" CONNECTION_APPEARANCE_XPATH = "/xmlns:cmap/xmlns:map/xmlns:connection-appearance-list/xmlns:connection-appearance" LINKING_PHRASE_XPATH = "/x...
Ruby
module Output def Output.wrong_args_error Output.error "malformed arguments." end def Output.help_message puts "Command format:" puts "cmap-eval [-options] key-file input-file" puts puts "Options:" puts "-h : Display this help message." puts "-d : Enable debug mode." end def ...
Ruby
require "fileutils" INPUT_PATH = "features/input_files/" SANDBOX_PATH = "sandbox/" def input_check file_name relative_file_name = INPUT_PATH + file_name file_check relative_file_name end def file_check full_file_name if !File.readable? full_file_name pending "File #{full_file_name} does not exist!" en...
Ruby
Given /^options of "([^"]*)"$/ do |options| @options = options end Given /^no command-line arguments$/ do # Do nothing; there are no command-line arguments! end Given /^key "([^"]*)" and input "([^"]*)"$/ do |key, input| @key_file_name = INPUT_PATH + key @input_file_name = SANDBOX_PATH + input ...
Ruby
# CxlHelper maintains a collection of facilities for dealing with the complexity of the cxl format. module CxlHelper NAMESPACE = "xmlns" NODE_PREFIX = "/#{NAMESPACE}:" # Manufacture the full xpath from the nodes. Any arguments that are not already a valid xpath are correctly-prefixed. def CxlHelper.create...
Ruby
# This is where execution begins in cmap-eval. cmap-eval expects to be called from the command line, and uses several # helper files, notably c_map.rb, to grade and mark cmaps. Execution begins with a call to execute, which might call # any of several local methods depending on the execution mode. # Fix the sear...
Ruby
require "src/output" require "src/c_map" require "src/debug" require "rubygems" require "nokogiri" # Methods and classes for handling/checking the inputs to the program. module Arguments_Helper def Arguments_Helper.validate_arguments args # Check that there are arguments. if args.size == 0 ...
Ruby
# Methods that make it easy to display standard debug messages to the console. module Debug # Make it globally known that debug is enabled. This has to be true to display the debug messages. def Debug.enable_debug @enabled = true end def Debug.no_misspelled_edges debug "There are no misspelled edges....
Ruby
require "src/cxl_helper" require "rubygems" require "text/levenshtein" require "src/Debug" include CxlHelper include Text include Debug # Methods and classes for manipulating and grading concept maps. module CMap # Constants for inserting the legend nodes. LEGEND_NODE_WIDTH = 60 LEGEND_NODE_HEIGHT ...
Ruby
# Module to handle console output for cmap-eval. module Output # Used to simplify calling all methods when there are bad arguments. def Output.bad_args_exit Output.wrong_args_error Output.help_message Output.exit end def Output.wrong_args_error Output.error "malformed arguments." end ...
Ruby
# Running this script will generate in the directory named "deploy" all of the important files necessary to actually # deploy the application. require "fileutils" DEPLOY = "deploy" DEPLOY_TOOLS = "deploy_tools" SOURCE = "src" PATH_FIXER = "path_fixer.bat" # A helper to make paths relative to the root ea...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class MoveNodesTest < Test::Unit::TestCase def test_no_nodes test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") end correct = Builder.ne...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class GradeUsingTest < Test::Unit::TestCase def test_perfect test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml.parent.namespa...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class CreateAppearancesConceptsTest < Test::Unit::TestCase def test_no_concepts test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { ...
Ruby
require "test/unit" require "src/c_map" require "src/cxl_helper" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class ConceptsInMapTest < Test::Unit::TestCase def test_no_edges test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { ...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML #I could probably test this a thousand ways, but that would take forever class InitializeTest < Test::Unit::TestCase def test_empty_map test = Builder.new do |xml| xml.cmap("x...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class TransformProbStateTest < Test::Unit::TestCase #You could probably break this by using every id possible for the string type in ruby #but odds are that's like several million id's ...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class GetPositionTest < Test::Unit::TestCase def test_1_edge_between test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml.parent.na...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class PropositionListTest < Test::Unit::TestCase def test_stardard_map test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml.map {...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class CreateAppearancesConnectionTest < Test::Unit::TestCase def test_no_connections test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { ...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class EdgeIDsBetweenTest < Test::Unit::TestCase def test_no_edges_between test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml.pare...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class EachUniquePairTest < Test::Unit::TestCase def test_stardard_input test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml.pare...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class NumberofDistinctConnectionsTest < Test::Unit::TestCase def test_stardard_input test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { ...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" # If you're looking at this test, I think this could be a bug. # I was under the impression that edges were one way (ie from and then to) # Which would make this an error in the code, not a broken test # if not then t...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class ConceptPositionTest < Test::Unit::TestCase def test_1_edge_between test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml.paren...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class AddGradeNodeTest < Test::Unit::TestCase def test_add_grade_node test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml.map { ...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class GetMaxNodeWidthTest < Test::Unit::TestCase def test_concept_max test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml.parent...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class SetConceptPositionTest < Test::Unit::TestCase def test_1_edge_between test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml.pa...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class TransformProbStateTest < Test::Unit::TestCase def test_stardard_input test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml....
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class EdgeLabelBetweenTest < Test::Unit::TestCase def test_no_edges_between test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml.pa...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class IsSpecialNodeTest < Test::Unit::TestCase def test_special_label test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") end cmap ...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class GetMaxNodeHightTest < Test::Unit::TestCase def test_concept_max test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml.parent...
Ruby
require "test/unit" require "src/c_map" require "rubygems" require "nokogiri" require "pp" include Nokogiri::XML class SetPositionTest < Test::Unit::TestCase def test_1_edge_between test = Builder.new do |xml| xml.cmap("xmlns" => "http://cmap.ihmc.us/xml/cmap/") { xml.parent.na...
Ruby
# Disable Rake-environment-task framework detection by uncommenting/setting to false # Warbler.framework_detection = false # Warbler web application assembly configuration file Warbler::Config.new do |config| # Features: additional options controlling how the jar is built. # Currently the following features are su...
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', ...
Ruby
require 'gdoc' require 'gdoc/document'
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
Ruby
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
Ruby
module CmsRails class Application < Rails::Application def self.sso_callback_url @@sso_callback rescue nil end def self.sso_callback_url=(url) @@sso_callback = url end end end
Ruby
# Be sure to restart your server when you modify this file. CmsRails::Application.config.session_store :encrypted_cookie_store, :key => '_cms_session_id' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table ...
Ruby
Rails.backtrace_cleaner.remove_silencers!
Ruby
CmsRails::Application.configure do # Settings specified here will take precedence over those in config/application.rb config.cache_classes = true config.action_controller.perform_caching = false # Log error messages when you accidentally call methods on nil. config.whiny_nils = true # Show full error rep...
Ruby
CmsRails::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned o...
Ruby
CmsRails::Application.configure do # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web ...
Ruby
CmsRails::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test...
Ruby
# Monkey patch to avoid riddle trying to exec stuff ENV['SPHINX_VERSION'] = '2.0.4' require 'riddle' module Riddle class Controller def sphinx_version ENV['SPHINX_VERSION'] end end end # Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails applicatio...
Ruby
require 'rubygems' # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
Ruby
require File.expand_path('../boot', __FILE__) require 'yaml' CMS_CONFIG = { "SECRET_TOKEN" => "0123456789abcdefChangethistosomethingsecret", "COMPANY" => "Company, Inc.", "COMPANY_LOGO" => nil, "COMPANY_LOGO_TEXT" => nil, "ABOUT_LINK" => "https://code.google.com/p/compliance-management/", "SECTION_IMPORT_...
Ruby
CmsRails::Application.routes.draw do resources :programs, :as => 'flow_programs', :only => [:index, :show, :new, :edit, :create, :update, :destroy] do member do get 'tooltip' get 'delete' get 'sections' get 'controls' end end resources :directives, :as => 'flow_directives', :only...
Ruby
module DatedModel include ActiveSupport::Concern def self.included(model) model.validate :stop_date_later_than_start_date end def stop_date_later_than_start_date if self.has_attribute? :stop_date if self.start_date.present? && self.stop_date.present? errors.add(:stop_date, 'Must be l...
Ruby
module BusinessObjectModel @business_object_models = nil def self.included(model) model.class_eval do end model.extend(ClassMethods) if model.ancestors.include?(ActiveRecord::Base) @business_object_models = [] if @business_object_models.nil? @business_object_models.push(model) end ...
Ruby
# Sanitize attributes before validation. # # Usage in model: # # sanitize_attributes :description, :documentation_description # module SanitizableAttributes # based on defaults from ActionView::Base.sanitized_allowed_tags with table tags added SANITIZED_ALLOWED_TAGS = %w(strong em b i p code pre tt samp kbd var s...
Ruby
# Provides utility functions for doing authorization on CRUD and other operations # to the model, given a standard way of getting the current user and # a list of users and roles for an object. # Note: requires the model to implement the authorizing_objects method # FIXME: Properly deal with anonymous users - or are w...
Ruby
module ControlState VALUES = [ :green, :yellow, :red, :unknown ] STATE_WEIGHT = { :green => 10, :unknown => 15, :yellow => 20, :red => 30 } STATE_IS_GOOD = { :green => true, :unknown => true } end
Ruby
module CommonModel def self.included(model) model.send(:include, AuthoredModel) model.has_many :object_people, :as => :personable, :dependent => :destroy model.has_many :people, :through => :object_people model.has_many :object_documents, :as => :documentable, :dependent => :destroy model.has_many...
Ruby
module StateModel def state index = read_attribute(:state) || self.class.columns_hash['state'].default ControlState::VALUES[index] end def state=(value) write_attribute(:state, ControlState::VALUES.index(value)) end def good_state? ControlState::STATE_IS_GOOD[state] end def self.include...
Ruby
module SearchableModel def self.included(model) model.extend(ClassMethods) end def self.sphinx_servers @@sphinx_servers ||= begin servers = CMS_CONFIG['FULLTEXT'] (servers or '').split(',').map do |host_port| { :host => host_port.split(':')[0], :port => host_port.split(':')[...
Ruby
module AuthoredModel # Typecast form parameters into the right primitive to work around a DataMapper dirty-detection bug. # # If we don't do this, the persistence layer thinks all non-strings params are modifications # where in fact we might just have changed false => 0, which is a no-op. This is important #...
Ruby
module DefaultRelationshipTypes RELATIONSHIP_TYPES = { :data_asset_has_process => { :source_type => "DataAsset", :target_type => "Process", :forward_phrase => "has", :reverse_phrase => "is a process for", :forward_description => "This data asset relies upon the following processes."...
Ruby
module SluggedModel def compact_slug return slug unless parent cslug = slug cslug[parent.slug] = '' if cslug[parent.slug] # Substring replacement of parent.slug with '' return cslug end def self.included(model) model.extend(ClassMethods) model.class_eval do validates :slug, :presen...
Ruby
# A lot of this is cribbed from how declarative_authorization handles # model-based authorization. module Authorization # Controller-independent method for retrieving the current user. # Needed for model security where the current controller is not available. # Primarily for use by the console and tests, where w...
Ruby
module RoleModel ROLES = [:tech, :business] def role index = read_attribute(:role) || self.class.columns_hash['role'].default ROLES[index] end def role=(value) write_attribute(:role, ROLES.index(value)) end def self.included(model) model.validates :role, :presence => true end end
Ruby
# RelatedModel mixin # # Many mixins that exist for managing relationships, and especially the relationship # traversal functions that are used in the context of authorization. # # Also creates some useful scoping functions that allow you to # create scopes for relationships with very little code. Example usage: # # In...
Ruby
class MultiEmailValidator < ActiveModel::EachValidator EMAIL_RE = /([^@\s]+)(?:@((?:[-a-z0-9]+\.)+[a-z]{2,}))/i EMAILS_RE = /\A\s*#{EMAIL_RE}(?:\s*[, ]\s*#{EMAIL_RE})*\Z/i def validate_each(record, attribute, value) unless value =~ EMAILS_RE #/\A([^@\s]+)(?:@((?:[-a-z0-9]+\.)+[a-z]{2,}))?\z/i record.er...
Ruby
class EmailValidator < ActiveModel::EachValidator EMAIL_RE = /([^@\s]+)(?:@((?:[-a-z0-9]+\.)+[a-z]{2,}))/i EMAILS_RE = /\A\s*#{EMAIL_RE}(?:\s*[, ]\s*#{EMAIL_RE})*\Z/i def validate_each(record, attribute, value) unless value =~ /^#{EMAIL_RE}$/ record.errors[attribute] << (options[:message] || "must be a...
Ruby
class UrlValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) valid = begin URI.parse(value).kind_of?(URI::HTTP) rescue URI::InvalidURIError false end unless valid record.errors[attribute] << (options[:message] || "is an invalid URL") end end e...
Ruby
module ApplicationHelper # Shorthand humanized text for admin pages def pat(sym) sym.to_s.humanize end # Default time display (localize at some point) def display_time(time) time.strftime("%Y-%m-%d %H:%M") rescue "-" end #:nocov: # FIXME: No obvious way to sanely test this. # Use instead of ...
Ruby
module FormHelper # Simple helper for repetitive form error spans def error_messages_inline(f, field_name) capture_haml do haml_tag :span, :class => 'help-inline' do f.object.errors[field_name].each do |error| haml_tag :span do haml_concat "#{error}" end en...
Ruby
require 'prawn_monkeypatch' module EvidenceHelper include ApplicationHelper # Capture evidence on Google Docs # # Convert the evidence document to PDF and watermark it with: # # * Acceptance date # * Who accepted the evidence # * Which system was the evidence attached to # # The PDF is then upload...
Ruby
# Helper methods defined here can be accessed in any controller or view in the application module GdataHelper # Transform a list of docs to a map by title def gdocs_by_title(docs) by_title = {} docs.values.each do |doc| by_title[doc.full_title] = doc end by_title end # Check if this is a...
Ruby
module SlugfilterHelper def walk_slug_tree(tree, options=nil, &block) options ||= {} depth = options[:depth] capture_haml do walk_slug_tree_children_helper(tree, nil, true, depth, options, &block) end end def walk_slug_tree_children_helper(tree, step=nil, odd=true, depth=nil, options=nil, ...
Ruby
module ProgramsDashHelper end
Ruby
module DirectivesHelper # Set up a directive and relevant stats for display def directive_stats(directive) stats = {} stats[:sections_count] = Section.where(:directive_id => directive.id).count() stats[:sections_done_count] = Section.joins(:controls).where(:directive_id => directive.id).count(:distinct ...
Ruby
module WelcomeHelper end
Ruby
# Helper methods defined here can be accessed in any controller or view in the application module DocumentHelper # Transform a document URL for display purposes. # # Currently just transforms a Google Docs url to the editable document # version. def transform_document_url(url) gdoc_url = Gdoc.edit_url_fr...
Ruby
module CyclesHelper def generate_default_title_for_cycle(program=nil) default_title = (program.nil? ? "" : program.title + " ") + "Audit" count = Cycle.where(Cycle.arel_table[:title].matches("%#{default_title}%")).count default_title += count > 0 ? " " + (count + 1).to_s : "" return "#{Date.today.ye...
Ruby
module ManyHelper # Many to many AJAX page - show form. # # Example: # if request.put? # post_many2many(:left_class => Control, # :right_class => DocumentDescriptor, # :right_relation => :evidence_descriptors, # :right_ids => :evid...
Ruby
module ControlsHelper def control_params control_params = params[:control] || {} if control_params[:directive_id] # TODO: Validate the user has access to add controls to the directive control_params[:directive] = Directive.where(:id => control_params.delete(:directive_id)).first end %w(typ...
Ruby
module BusinessObjectsHelper def related_objects(instance) if instance.is_a?(System) && instance.is_biz_process? instance.class.related_models("Process") else instance.class.related_models end end def arranged_related_objects(instance) end end
Ruby
module AuthorizationHelper # Roles def access_control_roles [:user, :admin, :risk, :admin_risk, :no_access] end def allowed_objs(objects, ability) objects #Authorization::allowed_objects(ability, @current_user, objects) end def check_model_risk_authorization(models) if current_user.can_man...
Ruby
module ImportHelper def trim_array(a) while !a.empty? && a.last.blank? a.pop end a end def validate_import_slug(object, object_name, expected_slug) raise ImportException.new("#{object_name} Code column does not exist") unless object["slug"] raise ImportException.new("#{object_name} Code...
Ruby
module DashboardHelper def init_quick_find @quick_find ||= {} @quick_find[:controls] ||= Control.all @quick_find[:systems] ||= System.where(:is_biz_process => false).all @quick_find[:biz_processes] ||= System.where(:is_biz_process => true).all end end
Ruby
module MappingHelper end
Ruby
class Category < ActiveRecord::Base include AuthoredModel attr_accessible :name, :scope_id, :parent, :required scope :ctype, lambda { |sid| where(:scope_id => sid) } acts_as_nested_set :scope => :scope_id, :dependent => :destroy has_many :categorizations, :dependent => :destroy has_many :controls, :throu...
Ruby
# A system to be audited class System < ActiveRecord::Base include CommonModel include SluggedModel include SearchableModel include AuthorizedModel include RelatedModel include SanitizableAttributes include DatedModel CATEGORY_TYPE_ID = 101 attr_accessible :title, :slug, :description, :url, :version...
Ruby
# A Regulation, Policy, or Contract class Directive < ActiveRecord::Base include CommonModel include SluggedModel include SearchableModel include AuthorizedModel include RelatedModel include SanitizableAttributes include DatedModel KINDS = [ "Regulation", "Company Controls Policy", "Compan...
Ruby
class ControlAssessment < ActiveRecord::Base include AuthoredModel include AuthorizedModel include SanitizableAttributes has_many :requests, :dependent => :nullify belongs_to :pbc_list belongs_to :control attr_accessible :control_version, :external_tod, :external_toe, :internal_tod, :internal_toe, :not...
Ruby
class ControlSection < ActiveRecord::Base include AuthoredModel attr_accessible :control, :section belongs_to :control belongs_to :section is_versioned_ext end
Ruby
require 'slugged_model' # A control objective (inverse of risk) # # The slug of a Section has to have the slug of the parent as prefix. class Section < ActiveRecord::Base include CommonModel include SluggedModel include SearchableModel include AuthorizedModel include RelatedModel include SanitizableAttribu...
Ruby
class Facility < ActiveRecord::Base include AuthoredModel include SluggedModel include SearchableModel include AuthorizedModel include RelatedModel include SanitizableAttributes include BusinessObjectModel include DatedModel attr_accessible :title, :slug, :description, :url, :version, :start_date, :s...
Ruby
class Relationship < ActiveRecord::Base include AuthoredModel # Note: No accessible attributes - you pretty much # never want to allow changes to these without authorization. belongs_to :source, :polymorphic => true belongs_to :destination, :polymorphic => true belongs_to :relationship_type is_versione...
Ruby
class ObjectDocument < ActiveRecord::Base include AuthoredModel include AuthorizedModel include RelatedModel include DatedModel attr_accessible :document, :documentable, :role, :notes, :start_date, :stop_date belongs_to :document belongs_to :documentable, :polymorphic => true is_versioned_ext def ...
Ruby