powerhome-scimitar 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +708 -0
  4. data/Rakefile +16 -0
  5. data/app/controllers/scimitar/active_record_backed_resources_controller.rb +257 -0
  6. data/app/controllers/scimitar/application_controller.rb +157 -0
  7. data/app/controllers/scimitar/resource_types_controller.rb +28 -0
  8. data/app/controllers/scimitar/resources_controller.rb +203 -0
  9. data/app/controllers/scimitar/schemas_controller.rb +21 -0
  10. data/app/controllers/scimitar/service_provider_configurations_controller.rb +8 -0
  11. data/app/models/scimitar/authentication_error.rb +9 -0
  12. data/app/models/scimitar/authentication_scheme.rb +18 -0
  13. data/app/models/scimitar/bulk.rb +8 -0
  14. data/app/models/scimitar/complex_types/address.rb +12 -0
  15. data/app/models/scimitar/complex_types/base.rb +83 -0
  16. data/app/models/scimitar/complex_types/email.rb +12 -0
  17. data/app/models/scimitar/complex_types/entitlement.rb +12 -0
  18. data/app/models/scimitar/complex_types/ims.rb +12 -0
  19. data/app/models/scimitar/complex_types/name.rb +12 -0
  20. data/app/models/scimitar/complex_types/phone_number.rb +12 -0
  21. data/app/models/scimitar/complex_types/photo.rb +12 -0
  22. data/app/models/scimitar/complex_types/reference_group.rb +12 -0
  23. data/app/models/scimitar/complex_types/reference_member.rb +12 -0
  24. data/app/models/scimitar/complex_types/role.rb +12 -0
  25. data/app/models/scimitar/complex_types/x509_certificate.rb +12 -0
  26. data/app/models/scimitar/engine_configuration.rb +32 -0
  27. data/app/models/scimitar/error_response.rb +32 -0
  28. data/app/models/scimitar/errors.rb +14 -0
  29. data/app/models/scimitar/filter.rb +11 -0
  30. data/app/models/scimitar/filter_error.rb +22 -0
  31. data/app/models/scimitar/invalid_syntax_error.rb +9 -0
  32. data/app/models/scimitar/lists/count.rb +64 -0
  33. data/app/models/scimitar/lists/query_parser.rb +745 -0
  34. data/app/models/scimitar/meta.rb +7 -0
  35. data/app/models/scimitar/not_found_error.rb +10 -0
  36. data/app/models/scimitar/resource_invalid_error.rb +9 -0
  37. data/app/models/scimitar/resource_type.rb +29 -0
  38. data/app/models/scimitar/resources/base.rb +190 -0
  39. data/app/models/scimitar/resources/group.rb +13 -0
  40. data/app/models/scimitar/resources/mixin.rb +1524 -0
  41. data/app/models/scimitar/resources/user.rb +13 -0
  42. data/app/models/scimitar/schema/address.rb +25 -0
  43. data/app/models/scimitar/schema/attribute.rb +132 -0
  44. data/app/models/scimitar/schema/base.rb +90 -0
  45. data/app/models/scimitar/schema/derived_attributes.rb +24 -0
  46. data/app/models/scimitar/schema/email.rb +10 -0
  47. data/app/models/scimitar/schema/entitlement.rb +10 -0
  48. data/app/models/scimitar/schema/group.rb +27 -0
  49. data/app/models/scimitar/schema/ims.rb +10 -0
  50. data/app/models/scimitar/schema/name.rb +20 -0
  51. data/app/models/scimitar/schema/phone_number.rb +10 -0
  52. data/app/models/scimitar/schema/photo.rb +10 -0
  53. data/app/models/scimitar/schema/reference_group.rb +23 -0
  54. data/app/models/scimitar/schema/reference_member.rb +21 -0
  55. data/app/models/scimitar/schema/role.rb +10 -0
  56. data/app/models/scimitar/schema/user.rb +52 -0
  57. data/app/models/scimitar/schema/vdtp.rb +18 -0
  58. data/app/models/scimitar/schema/x509_certificate.rb +22 -0
  59. data/app/models/scimitar/service_provider_configuration.rb +60 -0
  60. data/app/models/scimitar/supportable.rb +14 -0
  61. data/app/views/layouts/scimitar/application.html.erb +14 -0
  62. data/config/initializers/scimitar.rb +111 -0
  63. data/config/routes.rb +6 -0
  64. data/lib/scimitar/engine.rb +63 -0
  65. data/lib/scimitar/support/hash_with_indifferent_case_insensitive_access.rb +216 -0
  66. data/lib/scimitar/support/utilities.rb +51 -0
  67. data/lib/scimitar/version.rb +13 -0
  68. data/lib/scimitar.rb +29 -0
  69. data/spec/apps/dummy/app/controllers/custom_create_mock_users_controller.rb +25 -0
  70. data/spec/apps/dummy/app/controllers/custom_destroy_mock_users_controller.rb +24 -0
  71. data/spec/apps/dummy/app/controllers/custom_replace_mock_users_controller.rb +25 -0
  72. data/spec/apps/dummy/app/controllers/custom_request_verifiers_controller.rb +30 -0
  73. data/spec/apps/dummy/app/controllers/custom_save_mock_users_controller.rb +24 -0
  74. data/spec/apps/dummy/app/controllers/custom_update_mock_users_controller.rb +25 -0
  75. data/spec/apps/dummy/app/controllers/mock_groups_controller.rb +13 -0
  76. data/spec/apps/dummy/app/controllers/mock_users_controller.rb +13 -0
  77. data/spec/apps/dummy/app/models/mock_group.rb +83 -0
  78. data/spec/apps/dummy/app/models/mock_user.rb +132 -0
  79. data/spec/apps/dummy/config/application.rb +18 -0
  80. data/spec/apps/dummy/config/boot.rb +2 -0
  81. data/spec/apps/dummy/config/environment.rb +2 -0
  82. data/spec/apps/dummy/config/environments/test.rb +38 -0
  83. data/spec/apps/dummy/config/initializers/cookies_serializer.rb +3 -0
  84. data/spec/apps/dummy/config/initializers/scimitar.rb +61 -0
  85. data/spec/apps/dummy/config/initializers/session_store.rb +3 -0
  86. data/spec/apps/dummy/config/routes.rb +45 -0
  87. data/spec/apps/dummy/db/migrate/20210304014602_create_mock_users.rb +24 -0
  88. data/spec/apps/dummy/db/migrate/20210308020313_create_mock_groups.rb +10 -0
  89. data/spec/apps/dummy/db/migrate/20210308044214_create_join_table_mock_groups_mock_users.rb +13 -0
  90. data/spec/apps/dummy/db/schema.rb +48 -0
  91. data/spec/controllers/scimitar/application_controller_spec.rb +296 -0
  92. data/spec/controllers/scimitar/resource_types_controller_spec.rb +94 -0
  93. data/spec/controllers/scimitar/resources_controller_spec.rb +247 -0
  94. data/spec/controllers/scimitar/schemas_controller_spec.rb +83 -0
  95. data/spec/controllers/scimitar/service_provider_configurations_controller_spec.rb +22 -0
  96. data/spec/models/scimitar/complex_types/address_spec.rb +18 -0
  97. data/spec/models/scimitar/complex_types/email_spec.rb +21 -0
  98. data/spec/models/scimitar/lists/count_spec.rb +147 -0
  99. data/spec/models/scimitar/lists/query_parser_spec.rb +830 -0
  100. data/spec/models/scimitar/resource_type_spec.rb +21 -0
  101. data/spec/models/scimitar/resources/base_spec.rb +485 -0
  102. data/spec/models/scimitar/resources/base_validation_spec.rb +86 -0
  103. data/spec/models/scimitar/resources/mixin_spec.rb +3562 -0
  104. data/spec/models/scimitar/resources/user_spec.rb +68 -0
  105. data/spec/models/scimitar/schema/attribute_spec.rb +99 -0
  106. data/spec/models/scimitar/schema/base_spec.rb +64 -0
  107. data/spec/models/scimitar/schema/group_spec.rb +87 -0
  108. data/spec/models/scimitar/schema/user_spec.rb +720 -0
  109. data/spec/requests/active_record_backed_resources_controller_spec.rb +1354 -0
  110. data/spec/requests/application_controller_spec.rb +61 -0
  111. data/spec/requests/controller_configuration_spec.rb +17 -0
  112. data/spec/requests/engine_spec.rb +45 -0
  113. data/spec/spec_helper.rb +101 -0
  114. data/spec/spec_helper_spec.rb +30 -0
  115. data/spec/support/hash_with_indifferent_case_insensitive_access_spec.rb +169 -0
  116. metadata +321 -0
@@ -0,0 +1,83 @@
1
+ class MockGroup < ActiveRecord::Base
2
+
3
+ # ===========================================================================
4
+ # TEST ATTRIBUTES - see db/migrate/20210308020313_create_mock_groups.rb etc.
5
+ # ===========================================================================
6
+
7
+ READWRITE_ATTRS = %w{
8
+ id
9
+ scim_uid
10
+ display_name
11
+ scim_users_and_groups
12
+ }
13
+
14
+ has_and_belongs_to_many :mock_users
15
+
16
+ has_many :child_mock_groups, class_name: 'MockGroup', foreign_key: 'parent_id'
17
+
18
+ # ===========================================================================
19
+ # SCIM ADAPTER ACCESSORS
20
+ #
21
+ # Groups in SCIM can contain users or other groups. That's why the :find_with
22
+ # key in the Hash returned by ::scim_attributes_map has to check the type of
23
+ # thing it needs to find. Since the mappings only support a single read/write
24
+ # accessor, we need custom accessors to do what SCIM is expecting by turning
25
+ # the Rails associations to/from mixed, flat arrays of mock users and groups.
26
+ # ===========================================================================
27
+
28
+ def scim_users_and_groups
29
+ self.mock_users.to_a + self.child_mock_groups.to_a
30
+ end
31
+
32
+ def scim_users_and_groups=(mixed_array)
33
+ self.mock_users = mixed_array.select { |item| item.is_a?(MockUser) }
34
+ self.child_mock_groups = mixed_array.select { |item| item.is_a?(MockGroup) }
35
+ end
36
+
37
+ # ===========================================================================
38
+ # SCIM MIXIN AND REQUIRED METHODS
39
+ # ===========================================================================
40
+
41
+ def self.scim_resource_type
42
+ return Scimitar::Resources::Group
43
+ end
44
+
45
+ def self.scim_attributes_map
46
+ return {
47
+ id: :id,
48
+ externalId: :scim_uid,
49
+ displayName: :display_name,
50
+ members: [ # NB read-write, though individual items' attributes are immutable
51
+ list: :scim_users_and_groups, # See adapter accessors, earlier in this file
52
+ using: {
53
+ value: :id
54
+ },
55
+ find_with: -> (scim_list_entry) {
56
+ id = scim_list_entry['value']
57
+ type = scim_list_entry['type' ] || 'User' # Some online examples omit 'type' and believe 'User' will be assumed
58
+
59
+ case type.downcase
60
+ when 'user'
61
+ MockUser.find_by_primary_key(id)
62
+ when 'group'
63
+ MockGroup.find_by_id(id)
64
+ else
65
+ raise Scimitar::InvalidSyntaxError.new("Unrecognised type #{type.inspect}")
66
+ end
67
+ }
68
+ ]
69
+ }
70
+ end
71
+
72
+ def self.scim_mutable_attributes
73
+ return nil
74
+ end
75
+
76
+ def self.scim_queryable_attributes
77
+ return {
78
+ displayName: :display_name
79
+ }
80
+ end
81
+
82
+ include Scimitar::Resources::Mixin
83
+ end
@@ -0,0 +1,132 @@
1
+ class MockUser < ActiveRecord::Base
2
+
3
+ self.primary_key = :primary_key
4
+
5
+ # ===========================================================================
6
+ # TEST ATTRIBUTES - see db/migrate/20210304014602_create_mock_users.rb etc.
7
+ # ===========================================================================
8
+
9
+ READWRITE_ATTRS = %w{
10
+ primary_key
11
+ scim_uid
12
+ username
13
+ password
14
+ first_name
15
+ last_name
16
+ work_email_address
17
+ home_email_address
18
+ work_phone_number
19
+ organization
20
+ department
21
+ mock_groups
22
+ }
23
+
24
+ has_and_belongs_to_many :mock_groups
25
+
26
+ # A fixed value read-only attribute, in essence.
27
+ #
28
+ def is_active
29
+ true
30
+ end
31
+
32
+ # A test hook to force validation failures.
33
+ #
34
+ INVALID_USERNAME = 'invalid username'
35
+ validates :username, uniqueness: true, exclusion: { in: [INVALID_USERNAME] }
36
+
37
+ # ===========================================================================
38
+ # SCIM MIXIN AND REQUIRED METHODS
39
+ # ===========================================================================
40
+
41
+ def self.scim_resource_type
42
+ return Scimitar::Resources::User
43
+ end
44
+
45
+ def self.scim_attributes_map
46
+ return {
47
+ id: :primary_key,
48
+ externalId: :scim_uid,
49
+ userName: :username,
50
+ password: :password,
51
+ name: {
52
+ givenName: :first_name,
53
+ familyName: :last_name
54
+ },
55
+ emails: [
56
+ {
57
+ match: 'type',
58
+ with: 'work',
59
+ using: {
60
+ value: :work_email_address,
61
+ primary: true
62
+ }
63
+ },
64
+ {
65
+ match: 'type',
66
+ with: 'home',
67
+ using: {
68
+ value: :home_email_address,
69
+ primary: false
70
+ }
71
+ },
72
+ ],
73
+ phoneNumbers: [
74
+ {
75
+ match: 'type',
76
+ with: 'work',
77
+ using: {
78
+ value: :work_phone_number,
79
+ primary: false
80
+ }
81
+ },
82
+ ],
83
+ groups: [ # NB read-only, so no :find_with key
84
+ {
85
+ list: :mock_groups,
86
+ using: {
87
+ value: :id,
88
+ display: :display_name
89
+ }
90
+ }
91
+ ],
92
+ active: :is_active,
93
+
94
+ # Custom extension schema - see configuration in
95
+ # "spec/apps/dummy/config/initializers/scimitar.rb".
96
+ #
97
+ organization: :organization,
98
+ department: :department,
99
+ userGroups: [
100
+ {
101
+ list: :mock_groups,
102
+ find_with: ->(value) { MockGroup.find(value["value"]) },
103
+ using: {
104
+ value: :id,
105
+ display: :display_name
106
+ }
107
+ }
108
+ ]
109
+ }
110
+ end
111
+
112
+ def self.scim_mutable_attributes
113
+ return nil
114
+ end
115
+
116
+ def self.scim_queryable_attributes
117
+ return {
118
+ 'id' => { column: :primary_key },
119
+ 'externalId' => { column: :scim_uid },
120
+ 'meta.lastModified' => { column: :updated_at },
121
+ 'name.givenName' => { column: :first_name },
122
+ 'name.familyName' => { column: :last_name },
123
+ 'groups' => { column: MockGroup.arel_table[:id] },
124
+ 'groups.value' => { column: MockGroup.arel_table[:id] },
125
+ 'emails' => { columns: [ :work_email_address, :home_email_address ] },
126
+ 'emails.value' => { columns: [ :work_email_address, :home_email_address ] },
127
+ 'emails.type' => { ignore: true } # We can't filter on that; it'll just search all e-mails
128
+ }
129
+ end
130
+
131
+ include Scimitar::Resources::Mixin
132
+ end
@@ -0,0 +1,18 @@
1
+ require_relative 'boot'
2
+
3
+ require 'rails'
4
+ require 'active_model/railtie'
5
+ require 'active_record/railtie'
6
+ require 'action_controller/railtie'
7
+ require 'action_view/railtie'
8
+
9
+ Bundler.require(*Rails.groups)
10
+
11
+ require 'scimitar'
12
+
13
+ module Dummy
14
+ class Application < Rails::Application
15
+ config.load_defaults 7.0
16
+ end
17
+ end
18
+
@@ -0,0 +1,2 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../../Gemfile', __FILE__)
2
+ require 'bundler/setup'
@@ -0,0 +1,2 @@
1
+ require_relative 'application'
2
+ Rails.application.initialize!
@@ -0,0 +1,38 @@
1
+ require 'active_support/core_ext/integer/time'
2
+
3
+ Rails.application.configure do
4
+ config.cache_classes = true
5
+ config.eager_load = false
6
+
7
+ # Configure public file server for tests with Cache-Control for performance.
8
+ config.public_file_server.enabled = true
9
+ config.public_file_server.headers = {
10
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
11
+ }
12
+
13
+ # Show full error reports and disable caching.
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+ config.cache_store = :null_store
17
+
18
+ # Raise exceptions instead of rendering exception templates.
19
+ config.action_dispatch.show_exceptions = false
20
+
21
+ # Disable request forgery protection in test environment.
22
+ config.action_controller.allow_forgery_protection = false
23
+
24
+ # Print deprecation notices to the stderr.
25
+ config.active_support.deprecation = :stderr
26
+
27
+ # Raise exceptions for disallowed deprecations.
28
+ config.active_support.disallowed_deprecation = :raise
29
+
30
+ # Tell Active Support which deprecation messages to disallow.
31
+ config.active_support.disallowed_deprecation_warnings = []
32
+
33
+ # Raises error for missing translations.
34
+ config.i18n.raise_on_missing_translations = true
35
+
36
+ # Annotate rendered view with file names.
37
+ # config.action_view.annotate_rendered_view_with_filenames = true
38
+ end
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,61 @@
1
+ # Test app configuration.
2
+ #
3
+ # Note that as a result of https://github.com/RIPAGlobal/scimitar/issues/48,
4
+ # tests include a custom extension of the core User schema. A shortcoming of
5
+ # some of the code from which Scimitar was originally built is that those
6
+ # extensions are done with class-level ivars, so it is largely impossible (or
7
+ # at least, impractical in tests) to avoid polluting the core class itself
8
+ # with the extension.
9
+ #
10
+ # All related schema tests are written with this in mind.
11
+ #
12
+ Rails.application.config.to_prepare do
13
+ Scimitar.engine_configuration = Scimitar::EngineConfiguration.new({
14
+
15
+ application_controller_mixin: Module.new do
16
+ def self.included(base)
17
+ base.class_eval do
18
+ def test_hook; end
19
+ before_action :test_hook
20
+ end
21
+ end
22
+
23
+ def scim_schemas_url(options)
24
+ super(test: 1, **options)
25
+ end
26
+
27
+ def scim_resource_type_url(options)
28
+ super(test: 1, **options)
29
+ end
30
+ end
31
+
32
+ })
33
+
34
+ module ScimSchemaExtensions
35
+ module User
36
+ class Enterprise < Scimitar::Schema::Base
37
+ def initialize(options = {})
38
+ super(
39
+ name: 'ExtendedUser',
40
+ description: 'Enterprise extension for a User',
41
+ id: self.class.id,
42
+ scim_attributes: self.class.scim_attributes
43
+ )
44
+ end
45
+
46
+ def self.id
47
+ 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'
48
+ end
49
+
50
+ def self.scim_attributes
51
+ [
52
+ Scimitar::Schema::Attribute.new(name: 'organization', type: 'string'),
53
+ Scimitar::Schema::Attribute.new(name: 'department', type: 'string')
54
+ ]
55
+ end
56
+ end
57
+ end
58
+ end
59
+
60
+ Scimitar::Resources::User.extend_schema ScimSchemaExtensions::User::Enterprise
61
+ end
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,45 @@
1
+ # This test app mounts everything at the root level, but you'd usually be doing
2
+ # more in your Rails app than just SCIM! Wrapping with 'namespace :foo do' is
3
+ # strongly recommended to avoid routing namespace collisions. See README.md for
4
+ # an example.
5
+ #
6
+ Rails.application.routes.draw do
7
+ mount Scimitar::Engine, at: '/'
8
+
9
+ get 'Users', to: 'mock_users#index'
10
+ get 'Users/:id', to: 'mock_users#show'
11
+ post 'Users', to: 'mock_users#create'
12
+ put 'Users/:id', to: 'mock_users#replace'
13
+ patch 'Users/:id', to: 'mock_users#update'
14
+ delete 'Users/:id', to: 'mock_users#destroy'
15
+
16
+ get 'Groups', to: 'mock_groups#index'
17
+ get 'Groups/:id', to: 'mock_groups#show'
18
+ patch 'Groups/:id', to: 'mock_groups#update'
19
+
20
+ # For testing blocks passed to ActiveRecordBackedResourcesController#create,
21
+ # #update, #replace and #destroy.
22
+ #
23
+ post 'CustomCreateUsers', to: 'custom_create_mock_users#create'
24
+ patch 'CustomUpdateUsers/:id', to: 'custom_update_mock_users#update'
25
+ put 'CustomReplaceUsers/:id', to: 'custom_replace_mock_users#replace'
26
+ delete 'CustomDestroyUsers/:id', to: 'custom_destroy_mock_users#destroy'
27
+
28
+ # Needed because the auto-render of most of the above includes a 'url_for'
29
+ # call for a 'show' action, so we must include routes (implemented in the
30
+ # base class) for the "show" endpoint.
31
+ #
32
+ get 'CustomCreateUsers/:id', to: 'custom_create_mock_users#show'
33
+ get 'CustomUpdateUsers/:id', to: 'custom_update_mock_users#show'
34
+ get 'CustomReplaceUsers/:id', to: 'custom_replace_mock_users#show'
35
+
36
+ # For testing blocks passed to ActiveRecordBackedResourcesController#save!
37
+ #
38
+ post 'CustomSaveUsers', to: 'custom_save_mock_users#create'
39
+ get 'CustomSaveUsers/:id', to: 'custom_save_mock_users#show'
40
+
41
+ # For testing environment inside Scimitar::ApplicationController subclasses.
42
+ #
43
+ get 'CustomRequestVerifiers', to: 'custom_request_verifiers#index'
44
+ post 'CustomRequestVerifiers', to: 'custom_request_verifiers#create'
45
+ end
@@ -0,0 +1,24 @@
1
+ class CreateMockUsers < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :mock_users, id: :uuid, primary_key: :primary_key do |t|
4
+ t.timestamps
5
+
6
+ # Support part of the core schema
7
+ #
8
+ t.text :scim_uid
9
+ t.text :username
10
+ t.text :password
11
+ t.text :first_name
12
+ t.text :last_name
13
+ t.text :work_email_address
14
+ t.text :home_email_address
15
+ t.text :work_phone_number
16
+
17
+ # Support the custom extension schema - see configuration in
18
+ # "spec/apps/dummy/config/initializers/scimitar.rb".
19
+ #
20
+ t.text :organization
21
+ t.text :department
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,10 @@
1
+ class CreateMockGroups < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :mock_groups do |t|
4
+ t.text :scim_uid
5
+ t.text :display_name
6
+
7
+ t.references :parent
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ class CreateJoinTableMockGroupsMockUsers < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :mock_groups_users, id: false do | t |
4
+ t.references :mock_group, foreign_key: true, type: :int8, index: true, null: false
5
+ t.references :mock_user, type: :uuid, index: true, null: false, primary_key: :primary_key
6
+
7
+ # The 'foreign_key:' option (used above) only works for 'id' column names
8
+ # but the test data has a column named 'primary_key' for 'mock_users'.
9
+ #
10
+ t.foreign_key :mock_users, primary_key: :primary_key
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,48 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # This file is the source Rails uses to define your schema when running `bin/rails
6
+ # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema[7.1].define(version: 2021_03_08_044214) do
14
+ # These are extensions that must be enabled in order to support this database
15
+ enable_extension "plpgsql"
16
+
17
+ create_table "mock_groups", force: :cascade do |t|
18
+ t.text "scim_uid"
19
+ t.text "display_name"
20
+ t.bigint "parent_id"
21
+ t.index ["parent_id"], name: "index_mock_groups_on_parent_id"
22
+ end
23
+
24
+ create_table "mock_groups_users", id: false, force: :cascade do |t|
25
+ t.bigint "mock_group_id", null: false
26
+ t.uuid "mock_user_id", null: false
27
+ t.index ["mock_group_id"], name: "index_mock_groups_users_on_mock_group_id"
28
+ t.index ["mock_user_id"], name: "index_mock_groups_users_on_mock_user_id"
29
+ end
30
+
31
+ create_table "mock_users", primary_key: "primary_key", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
32
+ t.datetime "created_at", null: false
33
+ t.datetime "updated_at", null: false
34
+ t.text "scim_uid"
35
+ t.text "username"
36
+ t.text "password"
37
+ t.text "first_name"
38
+ t.text "last_name"
39
+ t.text "work_email_address"
40
+ t.text "home_email_address"
41
+ t.text "work_phone_number"
42
+ t.text "organization"
43
+ t.text "department"
44
+ end
45
+
46
+ add_foreign_key "mock_groups_users", "mock_groups"
47
+ add_foreign_key "mock_groups_users", "mock_users", primary_key: "primary_key"
48
+ end