Module: Hoodoo::ActiveRecord::Secure

Defined in:
lib/hoodoo/active/active_record/secure.rb,
lib/hoodoo/active/active_record/security_helper.rb

Overview

Support mixin for models subclassed from ActiveRecord::Base providing a core out-of-box Hoodoo data access security model. See Hoodoo::ActiveRecord::Secure::ClassMethods#secure for details.

See also:

Defined Under Namespace

Modules: ClassMethods Classes: SecurityHelper

Constant Summary collapse

OBJECT_EQLS_STAR =

Convenience constant defining an equals-single-security-value wildcard security exemption using the String ‘*’.

Hoodoo::ActiveRecord::Secure::SecurityHelper::eqls_wildcard( '*' )
ENUMERABLE_INCLUDES_STAR =

Convenience constant defining an included-in-enumerable-security-value wildcard security excemption using the String ‘*’.

Hoodoo::ActiveRecord::Secure::SecurityHelper::includes_wildcard( '*' )

Class Method Summary collapse

Class Method Details

.included(model) ⇒ Object

Instantiates this module when it is included.

Example:

class SomeModel < ActiveRecord::Base
  include Hoodoo::ActiveRecord::Secure
  # ...
end
model

The ActiveRecord::Base descendant that is including this module.



39
40
41
42
43
44
45
46
47
48
# File 'lib/hoodoo/active/active_record/secure.rb', line 39

def self.included( model )
  model.class_attribute(
    :nz_co_loyalty_hoodoo_secure_with,
    :instance_predicate => false,
    :instance_accessor  => false
  )

  instantiate( model ) unless model == Hoodoo::ActiveRecord::Base
  super( model )
end

.instantiate(model) ⇒ Object

When instantiated in an ActiveRecord::Base subclass, all of the Hoodoo::ActiveRecord::Secure::ClassMethods methods are defined as class methods on the including class.

model

The ActiveRecord::Base descendant that is including this module.



57
58
59
# File 'lib/hoodoo/active/active_record/secure.rb', line 57

def self.instantiate( model )
  model.extend( ClassMethods )
end