Class: DeviseScim::ScimAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/devise_scim/scim_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record, scim_object, tenant: nil) ⇒ ScimAdapter

Returns a new instance of ScimAdapter.



7
8
9
10
11
12
# File 'lib/devise_scim/scim_adapter.rb', line 7

def initialize(record, scim_object, tenant: nil)
  @record     = record
  @scim_user  = scim_object if scim_object.is_a?(Scim::User)
  @scim_group = scim_object if scim_object.is_a?(Scim::Group)
  @tenant     = tenant
end

Instance Attribute Details

#recordObject (readonly)

Returns the value of attribute record.



5
6
7
# File 'lib/devise_scim/scim_adapter.rb', line 5

def record
  @record
end

#scim_groupObject (readonly)

Returns the value of attribute scim_group.



5
6
7
# File 'lib/devise_scim/scim_adapter.rb', line 5

def scim_group
  @scim_group
end

#scim_userObject (readonly)

Returns the value of attribute scim_user.



5
6
7
# File 'lib/devise_scim/scim_adapter.rb', line 5

def scim_user
  @scim_user
end

#tenantObject (readonly)

Returns the value of attribute tenant.



5
6
7
# File 'lib/devise_scim/scim_adapter.rb', line 5

def tenant
  @tenant
end

Instance Method Details

#after_deprovisionObject



23
# File 'lib/devise_scim/scim_adapter.rb', line 23

def after_deprovision; end

#after_provisionObject



22
# File 'lib/devise_scim/scim_adapter.rb', line 22

def after_provision;   end

#attributes_for_createObject



14
15
16
# File 'lib/devise_scim/scim_adapter.rb', line 14

def attributes_for_create
  base_user_attributes
end

#attributes_for_updateObject



18
19
20
# File 'lib/devise_scim/scim_adapter.rb', line 18

def attributes_for_update
  base_user_attributes
end

#group_to_scimObject

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/devise_scim/scim_adapter.rb', line 40

def group_to_scim
  raise NotImplementedError, "#{self.class}#group_to_scim must be implemented when enable_groups is true"
end

#handle_group_createObject



25
# File 'lib/devise_scim/scim_adapter.rb', line 25

def handle_group_create;  end

#handle_group_destroyObject



27
# File 'lib/devise_scim/scim_adapter.rb', line 27

def handle_group_destroy; end

#handle_group_updateObject



26
# File 'lib/devise_scim/scim_adapter.rb', line 26

def handle_group_update;  end

#to_scimObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/devise_scim/scim_adapter.rb', line 29

def to_scim
  scim            = Scim::User.new
  scim.id         = record.id.to_s
  scim.user_name  = record.email
  scim.active     = resolve_active
  scim.emails     = [Scim::Email.new(value: record.email, type: "work", primary: true)]
  scim.name       = build_name
  scim.meta       = build_meta("User")
  scim
end