maestrano-connector-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +1 -0
  3. data/DEVELOPER.md +10 -0
  4. data/Gemfile +18 -0
  5. data/Gemfile.lock +222 -0
  6. data/LICENSE +21 -0
  7. data/README.md +138 -0
  8. data/Rakefile +37 -0
  9. data/VERSION +1 -0
  10. data/app/controllers/maestrano/account/group_users_controller.rb +20 -0
  11. data/app/controllers/maestrano/account/groups_controller.rb +22 -0
  12. data/app/controllers/maestrano/application_controller.rb +7 -0
  13. data/app/controllers/maestrano/auth/saml_controller.rb +31 -0
  14. data/app/controllers/maestrano/sessions_controller.rb +15 -0
  15. data/app/helpers/maestrano/connector/rails/session_helper.rb +17 -0
  16. data/app/jobs/maestrano/connector/rails/synchronization_job.rb +49 -0
  17. data/app/models/maestrano/connector/rails/complex_entity.rb +175 -0
  18. data/app/models/maestrano/connector/rails/concerns/entity.rb +231 -0
  19. data/app/models/maestrano/connector/rails/concerns/external.rb +13 -0
  20. data/app/models/maestrano/connector/rails/connector_logger.rb +9 -0
  21. data/app/models/maestrano/connector/rails/entity.rb +5 -0
  22. data/app/models/maestrano/connector/rails/external.rb +5 -0
  23. data/app/models/maestrano/connector/rails/id_map.rb +6 -0
  24. data/app/models/maestrano/connector/rails/organization.rb +60 -0
  25. data/app/models/maestrano/connector/rails/sub_entity_base.rb +32 -0
  26. data/app/models/maestrano/connector/rails/synchronization.rb +38 -0
  27. data/app/models/maestrano/connector/rails/user.rb +25 -0
  28. data/app/models/maestrano/connector/rails/user_organization_rel.rb +9 -0
  29. data/bin/rails +12 -0
  30. data/config/routes.rb +28 -0
  31. data/db/migrate/20151122162100_create_maestrano_connector_rails_users.rb +16 -0
  32. data/db/migrate/20151122162414_create_maestrano_connector_rails_organizations.rb +21 -0
  33. data/db/migrate/20151122162613_create_maestrano_connector_rails_user_organization_rels.rb +12 -0
  34. data/db/migrate/20151122163325_create_maestrano_connector_rails_synchronizations.rb +13 -0
  35. data/db/migrate/20151122163449_create_maestrano_connector_rails_id_maps.rb +18 -0
  36. data/lib/generators/connector/USAGE +2 -0
  37. data/lib/generators/connector/complex_entity_generator.rb +19 -0
  38. data/lib/generators/connector/install_generator.rb +70 -0
  39. data/lib/generators/connector/templates/admin_controller.rb +48 -0
  40. data/lib/generators/connector/templates/admin_index.html.erb +51 -0
  41. data/lib/generators/connector/templates/complex_entity_example/contact.rb +22 -0
  42. data/lib/generators/connector/templates/complex_entity_example/contact_and_lead.rb +56 -0
  43. data/lib/generators/connector/templates/complex_entity_example/contact_mapper.rb +17 -0
  44. data/lib/generators/connector/templates/complex_entity_example/lead.rb +22 -0
  45. data/lib/generators/connector/templates/complex_entity_example/lead_mapper.rb +15 -0
  46. data/lib/generators/connector/templates/complex_entity_example/person.rb +23 -0
  47. data/lib/generators/connector/templates/contact_and_lead.rb +55 -0
  48. data/lib/generators/connector/templates/entity.rb +48 -0
  49. data/lib/generators/connector/templates/example_entity.rb +26 -0
  50. data/lib/generators/connector/templates/external.rb +19 -0
  51. data/lib/generators/connector/templates/home_controller.rb +17 -0
  52. data/lib/generators/connector/templates/home_index.html.erb +42 -0
  53. data/lib/generators/connector/templates/oauth_controller.rb +45 -0
  54. data/lib/maestrano-connector-rails.rb +1 -0
  55. data/lib/maestrano/connector/rails.rb +13 -0
  56. data/maestrano-connector-rails.gemspec +197 -0
  57. data/maestrano.png +0 -0
  58. data/spec/dummy/README.md +1 -0
  59. data/spec/dummy/Rakefile +6 -0
  60. data/spec/dummy/app/assets/images/.keep +0 -0
  61. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  62. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  63. data/spec/dummy/app/controllers/admin_controller.rb +48 -0
  64. data/spec/dummy/app/controllers/application_controller.rb +8 -0
  65. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  66. data/spec/dummy/app/controllers/home_controller.rb +17 -0
  67. data/spec/dummy/app/controllers/oauth_controller.rb +45 -0
  68. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  69. data/spec/dummy/app/mailers/.keep +0 -0
  70. data/spec/dummy/app/models/.keep +0 -0
  71. data/spec/dummy/app/models/concerns/.keep +0 -0
  72. data/spec/dummy/app/models/entities/example_entitiy.rb +26 -0
  73. data/spec/dummy/app/models/maestrano/connector/rails/entity.rb +10 -0
  74. data/spec/dummy/app/models/maestrano/connector/rails/external.rb +11 -0
  75. data/spec/dummy/app/views/admin/index.html.erb +51 -0
  76. data/spec/dummy/app/views/home/index.html.erb +36 -0
  77. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  78. data/spec/dummy/bin/bundle +3 -0
  79. data/spec/dummy/bin/rails +4 -0
  80. data/spec/dummy/bin/rake +4 -0
  81. data/spec/dummy/bin/setup +29 -0
  82. data/spec/dummy/config.ru +4 -0
  83. data/spec/dummy/config/application.rb +26 -0
  84. data/spec/dummy/config/boot.rb +5 -0
  85. data/spec/dummy/config/database.yml +25 -0
  86. data/spec/dummy/config/environment.rb +5 -0
  87. data/spec/dummy/config/environments/development.rb +41 -0
  88. data/spec/dummy/config/environments/production.rb +79 -0
  89. data/spec/dummy/config/environments/test.rb +42 -0
  90. data/spec/dummy/config/initializers/assets.rb +11 -0
  91. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  92. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  93. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  94. data/spec/dummy/config/initializers/inflections.rb +16 -0
  95. data/spec/dummy/config/initializers/maestrano.rb +135 -0
  96. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  97. data/spec/dummy/config/initializers/session_store.rb +3 -0
  98. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  99. data/spec/dummy/config/locales/en.yml +23 -0
  100. data/spec/dummy/config/routes.rb +9 -0
  101. data/spec/dummy/config/secrets.yml +22 -0
  102. data/spec/dummy/db/development.sqlite3 +0 -0
  103. data/spec/dummy/db/migrate/20151209134445_create_maestrano_connector_rails_users.maestrano_connector_rails.rb +17 -0
  104. data/spec/dummy/db/migrate/20151209134446_create_maestrano_connector_rails_organizations.maestrano_connector_rails.rb +22 -0
  105. data/spec/dummy/db/migrate/20151209134447_create_maestrano_connector_rails_user_organization_rels.maestrano_connector_rails.rb +13 -0
  106. data/spec/dummy/db/migrate/20151209134448_create_maestrano_connector_rails_synchronizations.maestrano_connector_rails.rb +14 -0
  107. data/spec/dummy/db/migrate/20151209134449_create_maestrano_connector_rails_id_maps.maestrano_connector_rails.rb +19 -0
  108. data/spec/dummy/db/schema.rb +83 -0
  109. data/spec/dummy/lib/assets/.keep +0 -0
  110. data/spec/dummy/log/.keep +0 -0
  111. data/spec/dummy/public/404.html +67 -0
  112. data/spec/dummy/public/422.html +67 -0
  113. data/spec/dummy/public/500.html +66 -0
  114. data/spec/dummy/public/favicon.ico +0 -0
  115. data/spec/factories.rb +33 -0
  116. data/spec/jobs/syncrhonization_job_spec.rb +53 -0
  117. data/spec/models/complex_entity_spec.rb +353 -0
  118. data/spec/models/connector_logger_spec.rb +21 -0
  119. data/spec/models/entity_spec.rb +457 -0
  120. data/spec/models/external_spec.rb +15 -0
  121. data/spec/models/id_map_spec.rb +12 -0
  122. data/spec/models/organizaztion_spec.rb +105 -0
  123. data/spec/models/sub_entity_base_spec.rb +51 -0
  124. data/spec/models/synchronization_spec.rb +75 -0
  125. data/spec/models/user_organization_rel_spec.rb +14 -0
  126. data/spec/models/user_spec.rb +15 -0
  127. data/spec/spec_helper.rb +19 -0
  128. metadata +327 -0
@@ -0,0 +1,11 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = '1.0'
5
+
6
+ # Add additional assets to the asset load path
7
+ # Rails.application.config.assets.paths << Emoji.images_path
8
+
9
+ # Precompile additional assets.
10
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11
+ # Rails.application.config.assets.precompile += %w( search.js )
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -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,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,135 @@
1
+ Maestrano.configure do |config|
2
+
3
+ # ==> Environment configuration
4
+ # The environment to connect to.
5
+ # If set to 'production' then all Single Sign-On (SSO) and API requests
6
+ # will be made to maestrano.com
7
+ # If set to 'test' then requests will be made to api-sandbox.maestrano.io
8
+ # The api-sandbox allows you to easily test integration scenarios.
9
+ # More details on http://api-sandbox.maestrano.io
10
+ #
11
+ config.environment = 'test' # or 'production'
12
+
13
+ # ==> Application host
14
+ # This is your application host (e.g: my-app.com) which is ultimately
15
+ # used to redirect users to the right SAML url during SSO handshake.
16
+ #
17
+ config.app.host = (config.environment == 'production' ? 'https://my-app.com' : 'http://localhost:3000')
18
+
19
+ # ==> App ID & API key
20
+ # Your application App ID and API key which you can retrieve on http://maestrano.com
21
+ # via your cloud partner dashboard.
22
+ # For testing you can retrieve/generate an api.id and api.key from the API Sandbox directly
23
+ # on http://api-sandbox.maestrano.io
24
+ #
25
+ config.api.id = (config.environment == 'production' ? 'prod_app_id' : 'sandbox_app_id')
26
+ config.api.key = (config.environment == 'production' ? 'prod_api_key' : 'sandbox_api_key')
27
+
28
+ # ==> Single Sign-On activation
29
+ # Enable/Disable single sign-on. When troubleshooting authentication issues
30
+ # you might want to disable SSO temporarily
31
+ #
32
+ # config.sso.enabled = true
33
+
34
+ # ==> Single Sign-On Identity Manager
35
+ # By default we consider that the domain managing user identification
36
+ # is the same as your application host (see above config.app.host parameter)
37
+ # If you have a dedicated domain managing user identification and therefore
38
+ # responsible for the single sign-on handshake (e.g: https://idp.my-app.com)
39
+ # then you can specify it below
40
+ #
41
+ # config.sso.idm = (config.environment == 'production' ? 'https://idp.my-app.com' : 'http://localhost:3000')
42
+
43
+ # ==> SSO Initialization endpoint
44
+ # This is your application path to the SAML endpoint that allows users to
45
+ # initialize SSO authentication. Upon reaching this endpoint users your
46
+ # application will automatically create a SAML request and redirect the user
47
+ # to Maestrano. Maestrano will then authenticate and authorize the user. Upon
48
+ # authorization the user gets redirected to your application consumer endpoint
49
+ # (see below) for initial setup and/or login.
50
+ #
51
+ # The controller for this path is automatically
52
+ # generated when you run 'rake maestrano:install' and is available at
53
+ # <rails_root>/app/controllers/maestrano/auth/saml.rb
54
+ #
55
+ # config.sso.init_path = '/maestrano/auth/saml/init'
56
+
57
+ # ==> SSO Consumer endpoint
58
+ # This is your application path to the SAML endpoint that allows users to
59
+ # finalize SSO authentication. During the 'consume' action your application
60
+ # sets users (and associated group) up and/or log them in.
61
+ #
62
+ # The controller for this path is automatically
63
+ # generated when you run 'rake maestrano:install' and is available at
64
+ # <rails_root>/app/controllers/maestrano/auth/saml.rb
65
+ #
66
+ # config.sso.consume_path = '/maestrano/auth/saml/consume'
67
+
68
+ # ==> Single Logout activation
69
+ # Enable/Disable single logout. When troubleshooting authentication issues
70
+ # you might want to disable SLO temporarily.
71
+ # If set to false then Maestrano::SSO::Session#valid? - which should be
72
+ # used in a controller before filter to check user session - always return true
73
+ #
74
+ # config.sso.slo_enabled = true
75
+
76
+ # ==> SSO User creation mode
77
+ # !IMPORTANT
78
+ # On Maestrano users can take several "instances" of your service. You can consider
79
+ # each "instance" as 1) a billing entity and 2) a collaboration group (this is
80
+ # equivalent to a 'customer account' in a commercial world). When users login to
81
+ # your application via single sign-on they actually login via a specific group which
82
+ # is then supposed to determine which data they have access to inside your application.
83
+ #
84
+ # E.g: John and Jack are part of group 1. They should see the same data when they login to
85
+ # your application (employee info, analytics, sales etc..). John is also part of group 2
86
+ # but not Jack. Therefore only John should be able to see the data belonging to group 2.
87
+ #
88
+ # In most application this is done via collaboration/sharing/permission groups which is
89
+ # why a group is required to be created when a new user logs in via a new group (and
90
+ # also for billing purpose - you charge a group, not a user directly).
91
+ #
92
+ # == mode: 'real'
93
+ # In an ideal world a user should be able to belong to several groups in your application.
94
+ # In this case you would set the 'sso.creation_mode' to 'real' which means that the uid
95
+ # and email we pass to you are the actual user email and maestrano universal id.
96
+ #
97
+ # == mode: 'virtual'
98
+ # Now let's say that due to technical constraints your application cannot authorize a user
99
+ # to belong to several groups. Well next time John logs in via a different group there will
100
+ # be a problem: the user already exists (based on uid or email) and cannot be assigned
101
+ # to a second group. To fix this you can set the 'sso.creation_mode' to 'virtual'. In this
102
+ # mode users get assigned a truly unique uid and email across groups. So next time John logs
103
+ # in a whole new user account can be created for him without any validation problem. In this
104
+ # mode the email we assign to him looks like "usr-sdf54.cld-45aa2@mail.maestrano.com". But don't
105
+ # worry we take care of forwarding any email you would send to this address
106
+ #
107
+ # config.sso.creation_mode = 'real' # or 'virtual'
108
+
109
+ # ==> Account Webhooks
110
+ # Single sign on has been setup into your app and Maestrano users are now able
111
+ # to use your service. Great! Wait what happens when a business (group) decides to
112
+ # stop using your service? Also what happens when a user gets removed from a business?
113
+ # Well the endpoints below are for Maestrano to be able to notify you of such
114
+ # events.
115
+ #
116
+ # Even if the routes look restful we issue only issue DELETE requests for the moment
117
+ # to notify you of any service cancellation (group deletion) or any user being
118
+ # removed from a group.
119
+ #
120
+ # The controllers for these hooks path are automatically generated when
121
+ # you run 'rake maestrano:install' and is available under
122
+ # <rails_root>/app/controllers/maestrano/account/
123
+ #
124
+ # config.webhook.account.groups_path = '/maestrano/account/groups/:id',
125
+ # config.webhook.account.group_users_path = '/maestrano/account/groups/:group_id/users/:id',
126
+ end
127
+
128
+ # Example of multi-tenant configuration
129
+ Maestrano['other-tenant'].configure do |config|
130
+ config.environment = 'test'
131
+ config.app.host = (config.environment == 'production' ? 'https://my-app.com' : 'http://localhost:3000')
132
+
133
+ config.api.id = (config.environment == 'production' ? 'prod_app_id' : 'sandbox_app_id')
134
+ config.api.key = (config.environment == 'production' ? 'prod_api_key' : 'sandbox_api_key')
135
+ end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -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,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,9 @@
1
+ Rails.application.routes.draw do
2
+ mount Maestrano::Connector::Rails::Engine, at: '/'
3
+
4
+ root 'home#index'
5
+ get 'home/index' => 'home#index'
6
+ get 'admin/index' => 'admin#index'
7
+ put 'admin/update' => 'admin#update'
8
+ post 'admin/synchronize' => 'admin#synchronize'
9
+ end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: ff5dab4a3f61dfba37fb5c4d141ee976a50fa2f315044e8e8bdd0007f37a7cd429de51c66808977c5761a168037850fcbde47ce5c9e0d0166067feed956948e4
15
+
16
+ test:
17
+ secret_key_base: b1dc00ecd7788aa999dbb75ab82071bd40faf942409b8ba085067c52460860d00de343e6488d09c3c71c9f0d5b43fe57a008607741774c6c5102055abee2bb82
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
Binary file
@@ -0,0 +1,17 @@
1
+ # This migration comes from maestrano_connector_rails (originally 20151122162100)
2
+ class CreateMaestranoConnectorRailsUsers < ActiveRecord::Migration
3
+ def change
4
+ create_table :maestrano_connector_rails_users do |t|
5
+ t.string :provider
6
+ t.string :uid
7
+ t.string :first_name
8
+ t.string :last_name
9
+ t.string :email
10
+ t.string :tenant
11
+
12
+ t.timestamps null: false
13
+ end
14
+
15
+ add_index :maestrano_connector_rails_users, [:uid, :tenant], name: 'user_uid_index'
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ # This migration comes from maestrano_connector_rails (originally 20151122162414)
2
+ class CreateMaestranoConnectorRailsOrganizations < ActiveRecord::Migration
3
+ def change
4
+ create_table :maestrano_connector_rails_organizations do |t|
5
+ t.string :provider
6
+ t.string :uid
7
+ t.string :name
8
+ t.string :tenant
9
+
10
+ t.string :oauth_provider
11
+ t.string :oauth_uid
12
+ t.string :oauth_token
13
+ t.string :refresh_token
14
+ t.string :instance_url
15
+
16
+ t.string :synchronized_entities
17
+
18
+ t.timestamps null: false
19
+ end
20
+ add_index :maestrano_connector_rails_organizations, [:uid, :tenant], name: 'orga_uid_index'
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ # This migration comes from maestrano_connector_rails (originally 20151122162613)
2
+ class CreateMaestranoConnectorRailsUserOrganizationRels < ActiveRecord::Migration
3
+ def change
4
+ create_table :maestrano_connector_rails_user_organization_rels do |t|
5
+ t.integer :user_id
6
+ t.integer :organization_id
7
+
8
+ t.timestamps
9
+ end
10
+ add_index :maestrano_connector_rails_user_organization_rels, :organization_id, name: 'rels_orga_index'
11
+ add_index :maestrano_connector_rails_user_organization_rels, :user_id, name: 'rels_user_index'
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ # This migration comes from maestrano_connector_rails (originally 20151122163325)
2
+ class CreateMaestranoConnectorRailsSynchronizations < ActiveRecord::Migration
3
+ def change
4
+ create_table :maestrano_connector_rails_synchronizations do |t|
5
+ t.integer :organization_id
6
+ t.string :status
7
+ t.text :message
8
+ t.boolean :partial, default: false
9
+
10
+ t.timestamps null: false
11
+ end
12
+ add_index :maestrano_connector_rails_synchronizations, :organization_id, name: 'synchronization_orga_id_index'
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ # This migration comes from maestrano_connector_rails (originally 20151122163449)
2
+ class CreateMaestranoConnectorRailsIdMaps < ActiveRecord::Migration
3
+ def change
4
+ create_table :maestrano_connector_rails_id_maps do |t|
5
+ t.string :connec_id
6
+ t.string :connec_entity
7
+ t.string :external_id
8
+ t.string :external_entity
9
+ t.integer :organization_id
10
+ t.datetime :last_push_to_connec
11
+ t.datetime :last_push_to_external
12
+
13
+ t.timestamps null: false
14
+ end
15
+ add_index :maestrano_connector_rails_id_maps, [:connec_id, :connec_entity, :organization_id], name: 'idmap_connec_index'
16
+ add_index :maestrano_connector_rails_id_maps, [:external_id, :external_entity, :organization_id], name: 'idmap_external_index'
17
+ add_index :maestrano_connector_rails_id_maps, :organization_id, name: 'idmap_organization_index'
18
+ end
19
+ end
@@ -0,0 +1,83 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20151209134449) do
15
+
16
+ create_table "maestrano_connector_rails_id_maps", force: :cascade do |t|
17
+ t.string "connec_id"
18
+ t.string "connec_entity"
19
+ t.string "external_id"
20
+ t.string "external_entity"
21
+ t.integer "organization_id"
22
+ t.datetime "last_push_to_connec"
23
+ t.datetime "last_push_to_external"
24
+ t.datetime "created_at", null: false
25
+ t.datetime "updated_at", null: false
26
+ end
27
+
28
+ add_index "maestrano_connector_rails_id_maps", ["connec_id", "connec_entity", "organization_id"], name: "idmap_connec_index"
29
+ add_index "maestrano_connector_rails_id_maps", ["external_id", "external_entity", "organization_id"], name: "idmap_external_index"
30
+ add_index "maestrano_connector_rails_id_maps", ["organization_id"], name: "idmap_organization_index"
31
+
32
+ create_table "maestrano_connector_rails_organizations", force: :cascade do |t|
33
+ t.string "provider"
34
+ t.string "uid"
35
+ t.string "name"
36
+ t.string "tenant"
37
+ t.string "oauth_provider"
38
+ t.string "oauth_uid"
39
+ t.string "oauth_token"
40
+ t.string "refresh_token"
41
+ t.string "instance_url"
42
+ t.string "synchronized_entities"
43
+ t.datetime "created_at", null: false
44
+ t.datetime "updated_at", null: false
45
+ end
46
+
47
+ add_index "maestrano_connector_rails_organizations", ["uid", "tenant"], name: "orga_uid_index"
48
+
49
+ create_table "maestrano_connector_rails_synchronizations", force: :cascade do |t|
50
+ t.integer "organization_id"
51
+ t.string "status"
52
+ t.text "message"
53
+ t.boolean "partial", default: false
54
+ t.datetime "created_at", null: false
55
+ t.datetime "updated_at", null: false
56
+ end
57
+
58
+ add_index "maestrano_connector_rails_synchronizations", ["organization_id"], name: "synchronization_orga_id_index"
59
+
60
+ create_table "maestrano_connector_rails_user_organization_rels", force: :cascade do |t|
61
+ t.integer "user_id"
62
+ t.integer "organization_id"
63
+ t.datetime "created_at"
64
+ t.datetime "updated_at"
65
+ end
66
+
67
+ add_index "maestrano_connector_rails_user_organization_rels", ["organization_id"], name: "rels_orga_index"
68
+ add_index "maestrano_connector_rails_user_organization_rels", ["user_id"], name: "rels_user_index"
69
+
70
+ create_table "maestrano_connector_rails_users", force: :cascade do |t|
71
+ t.string "provider"
72
+ t.string "uid"
73
+ t.string "first_name"
74
+ t.string "last_name"
75
+ t.string "email"
76
+ t.string "tenant"
77
+ t.datetime "created_at", null: false
78
+ t.datetime "updated_at", null: false
79
+ end
80
+
81
+ add_index "maestrano_connector_rails_users", ["uid", "tenant"], name: "user_uid_index"
82
+
83
+ end