code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
class PbcList < ActiveRecord::Base
include AuthoredModel
include AuthorizedModel
include SanitizableAttributes
attr_accessible :audit_cycle
belongs_to :audit_cycle, :class_name => 'Cycle'
has_many :requests, :dependent => :destroy
has_many :control_assessments, :dependent => :destroy
is_versioned_ex... | Ruby |
class Option < ActiveRecord::Base
include AuthoredModel
include SanitizableAttributes
attr_accessible :role, :title, :description, :required
def to_s
title
end
scope :options_for, lambda { |role| where(:role => role) }
scope :ordered_by_title_desc, order("#{table_name}.title DESC")
is_versioned_... | Ruby |
class Response < ActiveRecord::Base
include AuthoredModel
include AuthorizedModel
attr_accessible :request, :system, :status, :population, :samples,
:population_document, :sample_worksheet_document, :sample_evidence_document
belongs_to :request
belongs_to :system
has_one :population_sample, :dependen... | Ruby |
class Risk < ActiveRecord::Base
include AuthoredModel
include SluggedModel
include SearchableModel
include AuthorizedModel
include RelatedModel
include SanitizableAttributes
include DatedModel
RATINGS = {
1 => "Minimal",
2 => "Moderate",
3 => "Significant",
4 => "Major",
5 => "Extre... | Ruby |
# A user session
class UserSession < Authlogic::Session::Base
extend ActiveModel::Naming
authenticate_with Account
cookie_key "_cms_cred"
end
| Ruby |
# Program to Directive many to many
class ProgramDirective < ActiveRecord::Base
include CommonModel
attr_accessible :program, :directive
belongs_to :program
belongs_to :directive
is_versioned_ext
#def self.by_system_control(system_id, control_id, cycle)
# sc = SystemControl
# .where(:system_id =... | Ruby |
class OrgGroup < 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, ... | Ruby |
class PopulationSample < ActiveRecord::Base
include CommonModel
attr_accessible :response, :population_document, :population, :sample_worksheet_document, :samples, :sample_evidence_document
belongs_to :response
belongs_to :population_document, :class_name => "Document"
belongs_to :sample_worksheet_document... | Ruby |
# Risk to RiskyAttribute many to many
class RiskRiskyAttribute < ActiveRecord::Base
include CommonModel
attr_accessible :risk, :risky_attribute
belongs_to :risk
belongs_to :risky_attribute
is_versioned_ext
#def self.by_system_control(system_id, control_id, cycle)
# sc = SystemControl
# .where(:s... | Ruby |
# Control to Risk many to many
class ControlRisk < ActiveRecord::Base
include CommonModel
attr_accessible :control, :risk
belongs_to :control
belongs_to :risk
is_versioned_ext
#def self.by_control_risk(risk_id, control_id, cycle)
# sc = ControlRisk
# .where(:risk_id => risk_id,
# :co... | 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 |
# A link between systems
class SystemSystem < ActiveRecord::Base
include AuthoredModel
attr_accessible :parent, :child, :type, :order
belongs_to :parent,
:foreign_key => 'parent_id', :class_name => 'System'
belongs_to :child,
:foreign_key => 'child_id', :class_name => 'System'
is_versioned_ext
... | 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 Product < 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, :type, :start_da... | 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 Person
#
# Normally an owner or otherwise responsbile for an audit function.
class Person < ActiveRecord::Base
include AuthoredModel
include AuthorizedModel
include RelatedModel
attr_accessible :email, :name, :company, :language
has_one :account
has_many :object_people, :dependent => :destroy
belo... | Ruby |
class Transaction < ActiveRecord::Base
include CommonModel
include SanitizableAttributes
attr_accessible :system, :title, :description
belongs_to :system
is_versioned_ext
sanitize_attributes :description
def display_name
title
end
end
| Ruby |
class Help < ActiveRecord::Base
include AuthoredModel
include SearchableModel
include AuthorizedModel
include SanitizableAttributes
is_versioned_ext
sanitize_attributes :content
attr_accessible :title, :content, :slug
end
| Ruby |
# System to CO many to many relationship
# `state` is the rolled up state from the System to Control association
class SystemSection < ActiveRecord::Base
include AuthoredModel
include StateModel
attr_accessible :section, :system
belongs_to :section
belongs_to :system
is_versioned_ext
end
| Ruby |
class Request < ActiveRecord::Base
include AuthoredModel
include AuthorizedModel
include SanitizableAttributes
include DatedModel
TYPES = {
1 => "Documentation",
2 => "Population Sample",
3 => "Interview"
}
STATUSES = [
"Draft",
"Requested",
"Responded",
"Amended/Updated Requ... | 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 |
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 |
# A Document
#
# Can either be linked by a URL or attached from Google Docs.
class Document < ActiveRecord::Base
include AuthoredModel
include AuthorizedModel
include RelatedModel
include SanitizableAttributes
VALID_SCHEMES = ['http', 'https', 'file']
attr_accessible :link, :title, :description, :type, :k... | 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 |
# A Program which links Directives
#
# The top of the Program -> Directive -> Control hierarchy
class Program < ActiveRecord::Base
include CommonModel
include SluggedModel
include SearchableModel
include AuthorizedModel
include RelatedModel
include SanitizableAttributes
include DatedModel
KINDS = [
... | Ruby |
class ControlControl < ActiveRecord::Base
include AuthoredModel
attr_accessible :control, :implemented_control
belongs_to :control
belongs_to :implemented_control, :class_name => 'Control'
is_versioned_ext
end
| 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 RelationshipType < ActiveRecord::Base
include AuthoredModel
include SanitizableAttributes
# attr_accessible :title, :body
self.primary_key = 'relationship_type'
has_many :relationships
is_versioned_ext
sanitize_attributes :description
end
| Ruby |
class Market < 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, :sto... | 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 |
class DataAsset < 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, :... | Ruby |
class Project < 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, :st... | Ruby |
# An Audit Cycle
#
# Used to group evidence for a particular audit of a program
# start_at is the audit period start date. If missing, this is a continuous process.
class Cycle < ActiveRecord::Base
include CommonModel
include AuthorizedModel
include SanitizableAttributes
include DatedModel
attr_accessible :... | Ruby |
class ControlSweeper < ActionController::Caching::Sweeper
observe Control
def after_create(control)
expire_cache_for(control)
end
def after_update(control)
expire_cache_for(control)
end
def after_destroy(control)
expire_cache_for(control)
end
private
def expire_cache_for(control)
#... | Ruby |
class ObjectPerson < ActiveRecord::Base
include AuthoredModel
include AuthorizedModel
include RelatedModel
include DatedModel
attr_accessible :person, :personable, :notes, :start_date, :stop_date
belongs_to :person
belongs_to :personable, :polymorphic => true
is_versioned_ext
validates :role, :pre... | Ruby |
class ControlSection < ActiveRecord::Base
include AuthoredModel
attr_accessible :control, :section
belongs_to :control
belongs_to :section
is_versioned_ext
end
| Ruby |
class RiskyAttribute < ActiveRecord::Base
include AuthoredModel
include SluggedModel
include SearchableModel
include AuthorizedModel
include RelatedModel
include SanitizableAttributes
include DatedModel
TYPE_STRINGS = %w(OrgGroup Product Facility Market Project DataAsset Process System)
attr_accessi... | Ruby |
class Categorization < ActiveRecord::Base
include AuthoredModel
attr_accessible :category, :categorizable
belongs_to :category
belongs_to :categorizable, :polymorphic => true
is_versioned_ext
end
| Ruby |
class Meeting < ActiveRecord::Base
include CommonModel
attr_accessible :response, :start_at, :calendar_url
belongs_to :response
is_versioned_ext
validates_presence_of :response, :calendar_url
def display_name
"#{response.system.title} meeting"
end
def calendar_url
self[:calendar_url].gsub ... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
require 'csv'
class DirectivesController < BaseObjectsController
# FIXME: Decide if the :section, controls, etc.
# methods should be moved, and what access controls they
# need.
before_filter :load_di... | Ruby |
# Handle PBC Lists
require 'csv'
class ImportException < Exception
end
class PbcListsController < BaseObjectsController
include ImportHelper
PBC_METADATA_MAP = Hash[*%w(
Type type
)]
PBC_REQUEST_MAP = Hash[*%w(
Request\ Type type_name
Control\ Code pbc_control_code
Control\ Description pbc_... | Ruby |
class SystemControlsController < BaseMappingsController
# access_control :acl do
# allow :superuser
# end
def index
@objects = SystemControl
if params[:system_id].present?
@objects = @objects.where(:system_id => params[:system_id])
end
if params[:control_id].present?
@objects = @obj... | Ruby |
class CategorizationsController < BaseMappingsController
# access_control :acl do
# allow :superuser
# end
def index
@objects = Categorization
if params[:object_id].present?
@objects = @objects.where(
:categorizable_type => params[:object_type],
:categorizable_id => params[:object... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2011
# License:: Apache 2.0
# Handle evidence collection
class EvidenceController < ApplicationController
include GdataHelper
include DocumentHelper
include EvidenceHelper
include ApplicationHelper
# access_control :acl do
# ... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
# Handle Org Groups
class OrgGroupsController < BusinessObjectsController
# access_control :acl do
# # FIXME: Implement real authorization
#
# allow :superuser
#
# actions :index do
# allow :re... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
# Handle Products
class ProductsController < BusinessObjectsController
# access_control :acl do
# # FIXME: Implement real authorization
#
# allow :superuser
#
# actions :index do
# allow :read,... | Ruby |
# Handle RiskyAttributes
class RiskyAttributesController < BaseObjectsController
# access_control :acl do
# # FIXME: Implement real authorization
#
# allow :superuser
#
# actions :index do
# allow :read, :read_risky_attribute
# end
#
# actions :new, :create do
# allow :create, :create_risky_a... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
# Browse sections
class SectionsController < BaseObjectsController
include DirectivesHelper
cache_sweeper :section_sweeper, :only => [:create, :update, :destroy]
# access_control :acl do
# allow :sup... | Ruby |
class BaseObjectsController < ApplicationController
include ApplicationHelper
before_filter :load_object,
:only => [ :show, :edit, :update, :delete, :destroy, :tooltip]
def index
object_set = model_class
if params[:s].present?
if object_set.respond_to?(:fulltext_search)
object_set = ob... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2011
# License:: Apache 2.0
# This class is the base for all controllers used in this app
#require 'dm-rails/middleware/identity_map'
class ApplicationController < ActionController::Base
include ApplicationHelper
include Authorizati... | Ruby |
class WelcomeController < ApplicationController
skip_before_filter :require_user
access_control :acl do
allow all
end
def index
session[:return_to] = login_dispatch_path
if current_user
redirect_to programs_dash_path
end
end
def login_dispatch
if current_user.nil?
redirect... | Ruby |
class MeetingsController < BaseObjectsController
# access_control :acl do
# allow :superuser
# end
layout 'dashboard'
no_base_action :index, :show, :tooltip
private
def object_path
flow_pbc_list_path(@meeting.response.request.pbc_list_id)
end
def post_destroy_path
flow_pbc_list_... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
# Admin dashboard
class AdminDashController < ApplicationController
# access_control :acl do
# allow :superuser
# end
before_filter :check_admin_authorization
layout 'dashboard'
def index
... | Ruby |
# Author:: Daniel Ring (mailto:danring+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
class CategoriesController < BaseObjectsController
# access_control :acl do
# allow :superuser
# end
layout 'dashboard'
no_base_action :tooltip
def index
@categories = Category
if params[... | Ruby |
class BaseMappingsController < ApplicationController
include ApplicationHelper
def create
if params[:items].present?
errors, objects = {}, {}
ActiveRecord::Base.transaction do
params[:items].keys.each do |id|
item_errors, item_object = create_or_update_object(params[:items][id])
... | Ruby |
class HelpController < ApplicationController
layout 'help'
# access_control :acl do
# allow logged_in
# end
# Render the requested partial under 'help'
def edit
slug = params[:help]['slug']
@help = Help.find_by_slug(slug) ||
Help.new(:slug => slug)
@help.title = params[:help]['title']
... | Ruby |
# Handle projects
class ProjectsController < BusinessObjectsController
access_control :acl do
# FIXME: Implement real authorization
allow :superuser
actions :new, :create do
allow :create, :create_project
end
actions :edit, :update do
allow :update, :update_project, :of => :project... | Ruby |
class RiskRiskyAttributesController < BaseMappingsController
# access_control :acl do
# allow :superuser
# end
before_filter :check_risk_authorization
def index
@objects = RiskRiskyAttribute
if params[:risk_id].present?
@objects = @objects.where(:risk_id => params[:risk_id])
end
if p... | Ruby |
class ProgramDirectivesController < BaseMappingsController
# access_control :acl do
# allow :superuser
# end
def index
@objects = ProgramDirective
if params[:program_id].present?
@objects = @objects.where(:program_id => params[:program_id])
if params[:directive_meta_kind].present?
@... | Ruby |
# Handle Requests
class RequestsController < BaseObjectsController
# access_control :acl do
# # FIXME: Implement real authorization
#
# allow :superuser
#
# actions :index do
# allow :read, :read_request
# end
#
# actions :new, :create do
# allow :create, :create_request
# end
#
# actio... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
class CyclesController < BaseObjectsController
# access_control :acl do
# allow :superuser
#
# actions :new, :create do
# allow :create, :create_cycle
# end
#
# actions :show, :tooltip do
# ... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
# Handle Controls
class ControlsController < BaseObjectsController
include ControlsHelper
include AuthorizationHelper
before_filter :load_control, :only => [:sections,
... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
# Handle markets
class MarketsController < BusinessObjectsController
# access_control :acl do
# # FIXME: Implement real authorization
#
# allow :superuser
#
# actions :new, :create do
# allow :... | Ruby |
class RelationshipsController < BaseMappingsController
# access_control :acl do
# allow :superuser
# allow :read, :read_relationship, :to => [:related_objects]
# end
def index
wants_risk = false
if is_risky_type?(params[:object_type]) || is_risky_type?(params[:related_model])
wants_risk = true... | Ruby |
class BusinessObjectsController < BaseObjectsController
include BusinessObjectsHelper
end
| Ruby |
class MappingController < ApplicationController
include ControlsHelper
layout 'dashboard'
respond_to :html, :json
cache_sweeper :section_sweeper, :only => [:map_rcontrol, :map_ccontrol, :update]
cache_sweeper :control_sweeper, :only => [:map_rcontrol, :map_ccontrol]
def show
@program = Program.find(p... | Ruby |
# Handle unincorporated design views here
class DesignController < ApplicationController
include ApplicationHelper
layout 'dashboard'
before_filter :require_design_feature
# Render the requested partial under 'design/templates'
def templates
template_name = params[:name]
respond_to do |format|
... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
# Programs overview
class ProgramsDashController < ApplicationController
include DashboardHelper
# access_control :acl do
# allow logged_in
# end
layout 'dashboard'
def index
@programs = allo... | Ruby |
class PopulationSamplesController < BaseObjectsController
# access_control :acl do
# allow :superuser
# end
layout 'dashboard'
no_base_action :index, :show, :tooltip
private
def object_path
flow_pbc_list_path(@population_sample.response.request.pbc_list_id)
end
def post_destroy_path
... | Ruby |
class UserSessionsController < ApplicationController
skip_before_filter :require_user, :except => :destroy
#before_filter :require_no_user, :only => [:new, :create]
#before_filter :require_user, :only => :destroy
layout 'welcome'
access_control :acl do
allow all
end
def login
if current_us... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
# Handle facilities
class FacilitiesController < BusinessObjectsController
# access_control :acl do
# # FIXME: Implement real authorization
#
# allow :superuser
#
# actions :new, :create do
# a... | Ruby |
class ControlRisksController < BaseMappingsController
# access_control :acl do
# allow :superuser
# end
def index
@objects = ControlRisk
if params[:risk_id].present?
@objects = @objects.where(:risk_id => params[:risk_id])
end
if params[:control_id].present?
@objects = @objects.where... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
require 'csv'
# HandleSystems
class SystemsController < BaseObjectsController
# access_control :acl do
# allow :superuser
#
# actions :new, :create, :import do
# allow :create, :create_system
# ... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
# Handle Transactions
class TransactionsController < BaseObjectsController
# access_control :acl do
# allow :superuser
# end
layout 'dashboard'
no_base_action :index, :show, :tooltip
private
... | Ruby |
class ObjectDocumentsController < BaseMappingsController
# access_control :acl do
# allow :superuser
#
# actions :index do
# allow :read, :read_object_document
# end
#
# actions :create do
# allow :create, :create_object_document
# end
#
# actions :list_edit, :create do
# allow :updat... | Ruby |
# Author:: Slobodan Kovacevic (mailto:basti@reciprocitynow.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
class OptionsController < BaseObjectsController
# access_control :acl do
# allow :superuser
# end
layout 'dashboard'
def index
@options = Option.all
if params[:s].present?
@op... | Ruby |
class SystemSystemsController < BaseMappingsController
# access_control :acl do
# allow :superuser
# end
def index
@objects = SystemSystem
if params[:parent_id].present?
@objects = @objects.where(:parent_id => params[:parent_id])
end
render :json => @objects, :include => :child
end
p... | Ruby |
# Handle markets
class DataAssetsController < BusinessObjectsController
# access_control :acl do
# # FIXME: Implement real authorization
#
# allow :superuser
#
# actions :new, :create do
# allow :create, :create_data_asset
# end
#
# actions :edit, :update do
# allow :update, :update_data_asse... | Ruby |
# Handle Risks
require 'csv'
class RisksController < BaseObjectsController
# access_control :acl do
# # FIXME: Implement real authorization
#
# allow :superuser
#
# actions :index do
# allow :read, :read_risk
# end
#
# actions :new, :create do
# allow :create, :create_risk
# end
#
# a... | Ruby |
# Handle Control Assessments
class ControlAssessmentsController < BaseObjectsController
# access_control :acl do
# # FIXME: Implement real authorization
#
# allow :superuser
#
# actions :index do
# allow :read, :read_control_assessment
# end
#
# actions :new, :create do
# allow :create, :crea... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
# Handle Documents
class DocumentsController < BaseObjectsController
# access_control :acl do
# allow :superuser
#
# actions :create, :new do
# allow :create, :create_document
# end
#
# acti... | Ruby |
class ObjectPeopleController < BaseMappingsController
# access_control :acl do
# allow :superuser
#
# actions :index do
# allow :read, :read_object_person
# end
#
# actions :create do
# allow :create, :create_object_person
# end
#
# actions :list_edit, :create do
# allow :update, :upd... | Ruby |
# Handle Responses
class ResponsesController < BaseObjectsController
# access_control :acl do
# # FIXME: Implement real authorization
#
# allow :superuser
#
# actions :index do
# allow :read, :read_response
# end
#
# actions :new, :create do
# allow :create, :create_response
# end
#
# a... | Ruby |
# Browse programs
class ProgramsController < BaseObjectsController
# access_control :acl do
# allow :superuser
#
# actions :new, :create do
# allow :create, :create_program
# end
#
# actions :edit, :update do
# allow :update, :update_program, :of => :program
# end
#
# actions :show, :toolt... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
class AccountsController < BaseObjectsController
# access_control :acl do
# allow :superuser
#
# actions :new, :create do
# allow :create, :create_account
# end
#
# actions :edit, :update do... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2011
# License:: Apache 2.0
# Handle Google Docs integration
class DocumentController < ApplicationController
include GdataHelper
include DocumentHelper
# access_control :acl do
# allow :superuser
#
# actions :index do
# ... | Ruby |
# Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2012
# License:: Apache 2.0
class PeopleController < BaseObjectsController
# access_control :acl do
# allow :superuser
#
# actions :index do
# allow :read, :read_person
# end
#
# actions :new, :create do
# allow :... | Ruby |
class SectionRowConverter < BaseRowConverter
@model_class = :Section
def setup_object
object = setup_object_by_slug(attrs)
if object.directive.present? && object.directive != @importer.options[:directive]
add_error(:slug, "Code is used in #{object.directive.meta_kind.to_s.titleize}: #{object.direc... | Ruby |
module ErrorWarningMessageObject
attr_accessor :errors, :warnings, :messages
def initialize
@base_errors = []
@errors = HashWithIndifferentAccess.new
@base_warnings = []
@warnings = HashWithIndifferentAccess.new
@base_messages = []
@messages = HashWithIndifferentAccess.new
super
end... | Ruby |
class SystemRowConverter < BaseRowConverter
@model_class = :System
def setup_object
object = setup_object_by_slug(attrs)
if object.new_record?
object.infrastructure = false if object.infrastructure.nil?
object.is_biz_process = true if @importer.options[:is_biz_process]
else
if object... | Ruby |
class ControlRowConverter < BaseRowConverter
@model_class = :Control
def setup_object
object = setup_object_by_slug(attrs)
if object.directive.present? && object.directive != @importer.options[:directive]
add_error(:slug, "Code is used in #{object.directive.meta_kind.to_s.titleize}: #{object.directi... | Ruby |
class RiskRowConverter < BaseRowConverter
@model_class = :Risk
def setup_object
object = setup_object_by_slug(attrs)
if !object.new_record?
add_warning(:slug, "Risk already exists and will be updated")
end
end
def reify
handle(:slug, SlugColumnHandler)
handle(:controls, LinkControl... | Ruby |
require 'csv'
class ImportException < Exception
end
class BaseConverter
attr_accessor :rows, :objects, :all_objects, :options, :warnings, :errors, :slugs
def initialize(rows_or_objects, options=nil)
@options = options || {}
if @options[:export]
@objects = rows_or_objects
@rows = []
els... | 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 |
Rails.backtrace_cleaner.remove_silencers!
| Ruby |
require 'gdoc'
require 'gdoc/document'
| 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.
# 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 |
# 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.
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.