Class: Scimitar::Schema::User

Inherits:
Base
  • Object
show all
Defined in:
app/models/scimitar/schema/user.rb

Overview

Represents the schema for the User resource See also Scimitar::Resources::User

Instance Attribute Summary

Attributes inherited from Base

#description, #id, #meta, #name, #scim_attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#as_json, cloned_scim_attributes, find_attribute, valid?

Constructor Details

#initialize(options = {}) ⇒ User

Returns a new instance of User.



7
8
9
10
11
12
13
# File 'app/models/scimitar/schema/user.rb', line 7

def initialize(options = {})
  super(name: 'User',
        id: self.class.id,
        description: 'Represents a User',
        scim_attributes: self.class.scim_attributes)

end

Class Method Details

.idObject



15
16
17
# File 'app/models/scimitar/schema/user.rb', line 15

def self.id
  'urn:ietf:params:scim:schemas:core:2.0:User'
end

.scim_attributesObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/models/scimitar/schema/user.rb', line 19

def self.scim_attributes
  [
    Attribute.new(name: 'userName',          type: 'string', uniqueness: 'server', required: true),

    Attribute.new(name: 'name',              complexType: Scimitar::ComplexTypes::Name),

    Attribute.new(name: 'displayName',       type: 'string'),
    Attribute.new(name: 'nickName',          type: 'string'),
    Attribute.new(name: 'profileUrl',        type: 'string'),
    Attribute.new(name: 'title',             type: 'string'),
    Attribute.new(name: 'userType',          type: 'string'),
    Attribute.new(name: 'preferredLanguage', type: 'string'),
    Attribute.new(name: 'locale',            type: 'string'),
    Attribute.new(name: 'timezone',          type: 'string'),

    Attribute.new(name: 'active',            type: 'boolean'),

    Attribute.new(name: 'password',          type: 'string', mutability: 'writeOnly', returned: 'never'),

    Attribute.new(name: 'emails',            multiValued: true, complexType: Scimitar::ComplexTypes::Email),
    Attribute.new(name: 'phoneNumbers',      multiValued: true, complexType: Scimitar::ComplexTypes::PhoneNumber),
    Attribute.new(name: 'ims',               multiValued: true, complexType: Scimitar::ComplexTypes::Ims),
    Attribute.new(name: 'photos',            multiValued: true, complexType: Scimitar::ComplexTypes::Photo),
    Attribute.new(name: 'addresses',         multiValued: true, complexType: Scimitar::ComplexTypes::Address),
    Attribute.new(name: 'groups',            multiValued: true, complexType: Scimitar::ComplexTypes::ReferenceGroup, mutability: 'readOnly'),
    Attribute.new(name: 'entitlements',      multiValued: true, complexType: Scimitar::ComplexTypes::Entitlement),
    Attribute.new(name: 'roles',             multiValued: true, complexType: Scimitar::ComplexTypes::Role),
    Attribute.new(name: 'x509Certificates',  multiValued: true, complexType: Scimitar::ComplexTypes::X509Certificate),
  ]
end