Module: Gatekeeper
- Defined in:
- app/models/gatekeeper/user.rb,
lib/gatekeeper.rb,
lib/gatekeeper/engine.rb,
lib/gatekeeper/version.rb,
app/models/gatekeeper/model.rb,
lib/gatekeeper/configuration.rb,
app/models/gatekeeper/related_model.rb,
app/models/gatekeeper/embedded_model.rb,
lib/generators/gatekeeper/config_generator.rb,
app/controllers/concerns/gatekeeper/responder.rb
Overview
This is an example embedded model used for testing purposes. It represents a real world model with various fields and methods.
Defined Under Namespace
Modules: Generators, Responder Classes: Configuration, EmbeddedModel, Engine, Model, RelatedModel, User
Constant Summary collapse
- VERSION =
'0.1.3'
Class Attribute Summary collapse
-
.configuration ⇒ Gatekeeper::Configuration
Initializes configuration.
Class Method Summary collapse
-
.configure {|@configuration| ... } ⇒ nil
Method to configure various Gatekeeper options.
-
.default_allowed_info_names(user, model_class, &block) ⇒ Array<Symbol>
Returns default allowed info names for a user.
-
.response_ignored_variables ⇒ Array<Symbol>
Variables to not include in controller response.
Class Attribute Details
.configuration ⇒ Gatekeeper::Configuration
Initializes configuration.
9 10 11 |
# File 'lib/gatekeeper.rb', line 9 def configuration @configuration end |
Class Method Details
.configure {|@configuration| ... } ⇒ nil
Method to configure various Gatekeeper options.
23 24 25 26 |
# File 'lib/gatekeeper.rb', line 23 def configure @configuration ||= Gatekeeper::Configuration.new yield @configuration end |
.default_allowed_info_names(user, model_class, &block) ⇒ Array<Symbol>
Returns default allowed info names for a user.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/gatekeeper.rb', line 35 def default_allowed_info_names(user, model_class, &block) if configuration.bypass_allowed_info.respond_to? :call bypassable = configuration.bypass_allowed_info.call(user) else bypassable = false end if bypassable # Sees everything! model_class.document_all_info else if block_given? block.call(user) || [] else [] end end end |
.response_ignored_variables ⇒ Array<Symbol>
Variables to not include in controller response.
58 59 60 61 62 |
# File 'lib/gatekeeper.rb', line 58 def response_ignored_variables Gatekeeper.configuration.response_ignored_variables | [ :@marked_for_same_origin_verification, :@browser, :@behavior, :@options, :@args, :@shell, :@destination_stack ] end |