Module: Maestrano::Rails::MaestranoAuthResource::ClassMethods

Defined in:
lib/maestrano/rails/models/maestrano_auth_resource.rb

Overview

These methods are used to extend the behaviour of a model

Instance Method Summary collapse

Instance Method Details

#maestrano_group_via(provider_field, uid_field, tenant_field, &block) ⇒ Object

Configure a group model with mapping to SSO fields and add group behaviour



30
31
32
33
34
35
# File 'lib/maestrano/rails/models/maestrano_auth_resource.rb', line 30

def maestrano_group_via(provider_field, uid_field, tenant_field, &block)
  extend Maestrano::Rails::MaestranoAuthResource::LocalClassGenericMethods
  self.maestrano_generic_configurator(provider_field, uid_field, tenant_field, &block)
  
  include Maestrano::Rails::MaestranoAuthResource::LocalInstanceGroupMethods
end

#maestrano_user_via(provider_field, uid_field, tenant_field, &block) ⇒ Object

Configure a user model with mapping to SSO fields and add user behaviour



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/maestrano/rails/models/maestrano_auth_resource.rb', line 16

def maestrano_user_via(provider_field, uid_field, tenant_field, &block)
  extend Maestrano::Rails::MaestranoAuthResource::LocalClassGenericMethods
  self.maestrano_generic_configurator(provider_field, uid_field, tenant_field, &block)
  
  include Maestrano::Rails::MaestranoAuthResource::LocalInstanceUserMethods
  
  # Finally extend ApplicationController with MaestranoSecurity
  # filters. It's useless to do that unless a maestrano_user is
  # declared
  ApplicationController.send :include, Maestrano::Rails::MaestranoSecurity
end