Module: Thwart

Defined in:
lib/thwart.rb,
lib/thwart/dsl.rb,
lib/thwart/role.rb,
lib/thwart/actor.rb,
lib/thwart/canable.rb,
lib/thwart/enforcer.rb,
lib/thwart/role_builder.rb,
lib/thwart/actions_store.rb,
lib/thwart/role_registry.rb,
lib/thwart/action_group_builder.rb

Defined Under Namespace

Modules: Ables, Actor, Cans, Enforcer, Resource, Role Classes: ActionGroupBuilder, ActionOrGroupNotFoundError, ActionsStore, DefaultRole, Dsl, DslError, DuplicateRoleError, MissingAttributeError, MissingRoleError, NoPermissionError, OustideRoleDefinitionError, RoleBuilder, RoleRegistry

Constant Summary collapse

CrudActions =

The default can => able methods for CRUD

{:create => :creatable, :show => :showable, :update => :updatable, :destroy => :destroyable}
Actions =
ActionsStore.new
Actionables =
ActionGroupBuilder.new(Actions)
Roles =
RoleRegistry.new

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.actor_must_play_roleObject

Returns the value of attribute actor_must_play_role.



42
43
44
# File 'lib/thwart.rb', line 42

def actor_must_play_role
  @actor_must_play_role
end

.all_classes_are_resourcesObject

Returns the value of attribute all_classes_are_resources.



42
43
44
# File 'lib/thwart.rb', line 42

def all_classes_are_resources
  @all_classes_are_resources
end

.default_query_responseObject

Returns the value of attribute default_query_response.



42
43
44
# File 'lib/thwart.rb', line 42

def default_query_response
  @default_query_response
end

.last_query_pathObject

Returns the value of attribute last_query_path.



42
43
44
# File 'lib/thwart.rb', line 42

def last_query_path
  @last_query_path
end

.log_query_pathObject

Returns the value of attribute log_query_path.



42
43
44
# File 'lib/thwart.rb', line 42

def log_query_path
  @log_query_path
end

.role_dslObject (readonly)

Returns the value of attribute role_dsl.



41
42
43
# File 'lib/thwart.rb', line 41

def role_dsl
  @role_dsl
end

.role_registryObject

Returns the value of attribute role_registry.



42
43
44
# File 'lib/thwart.rb', line 42

def role_registry
  @role_registry
end

Class Method Details

.configure(&block) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/thwart.rb', line 48

def configure(&block)
  # Create builder DSLs for this configuration block
  @role_dsl = RoleBuilder.new(Actionables)
  Roles.monitor_builder(@role_dsl)
  
  # Configure
  dsl = Thwart::Dsl.new(:role => :create_role, :action => :create_action, :action_group => :create_action_group)
  dsl.all = false
  dsl.evaluate(self, &block)
  
  # Unset and stop monitoring builder DSLs so they can be GC'd
  @role_dsl = nil
  Roles.monitor_builder(nil)
  self
end