osso 0.0.3.7 → 0.0.3.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e43fcdb190c819ff0da0cb9ac9358152f42804f7fa116771d9dd458bf141c30
4
- data.tar.gz: 65f6005798ec50a1ad4dd297c695aa08c80fb2ba8cc059eaa38cfb5f15a13dcc
3
+ metadata.gz: 73de8a2c5af9b7d62c94a5ed34c094455dc9b49b7345eb252308f7048e1164c0
4
+ data.tar.gz: c37913b5f3a857245d588ad03155ece0c5aca99c22c4c56069f50d442cb74db5
5
5
  SHA512:
6
- metadata.gz: 617a3e1e5a5b476c4758476f7708e12a752d8d448a46866e37352ee319dcd5c08f2d0726d81c4ec1054e5129073840d6d76aad24ef938a1ccaf475bd72cc6d7b
7
- data.tar.gz: 77f11455be71add868a54d61683be3dc9a09231a92fdbf1abbb05c685732c6469eaeb9acbbd765ff0ff894960224bdcb736525687b234c002a46a1e4d0b2dba6
6
+ metadata.gz: 3047a07787aa764d105e77580846d60a943d4bd859baed5c861aebd8face6fb461342f3cccc01cc58e33d66310ba0d852185605fea09eb54d21c126aa149230c
7
+ data.tar.gz: f61b3e5aa31946a69512762601d08ecc021be26a56df0b182fc826d53e7be0836ea019c90ad09fc6b927dc3b37ee8efbc01e6145c0c4af4ff97198b9cd89828c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- osso (0.0.3.7)
4
+ osso (0.0.3.8)
5
5
  activesupport (>= 6.0.3.2)
6
6
  graphql
7
7
  jwt
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 2020_07_15_205801) do
13
+ ActiveRecord::Schema.define(version: 2020_07_22_230116) do
14
14
 
15
15
  # These are extensions that must be enabled in order to support this database
16
16
  enable_extension "pgcrypto"
@@ -51,17 +51,8 @@ ActiveRecord::Schema.define(version: 2020_07_15_205801) do
51
51
  t.index ["oauth_client_id"], name: "index_enterprise_accounts_on_oauth_client_id"
52
52
  end
53
53
 
54
- create_table "identity_providers", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
55
- t.string "service"
56
- t.string "domain", null: false
57
- t.string "sso_url"
58
- t.text "sso_cert"
59
- t.uuid "enterprise_account_id"
60
- t.uuid "oauth_client_id"
61
- t.index ["domain"], name: "index_identity_providers_on_domain"
62
- t.index ["enterprise_account_id"], name: "index_identity_providers_on_enterprise_account_id"
63
- t.index ["oauth_client_id"], name: "index_identity_providers_on_oauth_client_id"
64
- end
54
+ # Could not dump table "identity_providers" because of following StandardError
55
+ # Unknown type 'identity_provider_status' for column 'status'
65
56
 
66
57
  create_table "oauth_access_grants", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
67
58
  t.uuid "resource_owner_id", null: false
@@ -4,7 +4,7 @@ class AddIdentityProviderServiceEnum < ActiveRecord::Migration[6.0]
4
4
  execute <<-SQL
5
5
  CREATE TYPE identity_provider_service AS ENUM ('OKTA', 'AZURE');
6
6
  SQL
7
- chnage_column :identity_providers, :service, :identity_provider_service
7
+ change_column :identity_providers, :service, :identity_provider_service
8
8
  end
9
9
 
10
10
  def down
@@ -0,0 +1,15 @@
1
+ class AddIdentityProviderStatusEnumAndUseOnIdentityProviders < ActiveRecord::Migration[6.0]
2
+ def up
3
+ execute <<~SQL
4
+ CREATE TYPE identity_provider_status AS ENUM ('PENDING', 'CONFIGURED', 'ACTIVE', 'ERROR');
5
+ SQL
6
+ add_column :identity_providers, :status, :identity_provider_status, default: 'PENDING'
7
+ end
8
+
9
+ def down
10
+ remove_column :identity_providers, :status
11
+ execute <<~SQL
12
+ DROP TYPE identity_provider_status;
13
+ SQL
14
+ end
15
+ end
@@ -9,6 +9,7 @@ require_relative 'types/base_object'
9
9
  require_relative 'types/base_enum'
10
10
  require_relative 'types/base_input_object'
11
11
  require_relative 'types/identity_provider_service'
12
+ require_relative 'types/identity_provider_status'
12
13
  require_relative 'types/identity_provider'
13
14
  require_relative 'types/enterprise_account'
14
15
  require_relative 'types/oauth_client'
@@ -17,13 +17,9 @@ module Osso
17
17
  field :acs_url, String, null: false
18
18
  field :sso_url, String, null: true
19
19
  field :sso_cert, String, null: true
20
- field :configured, Boolean, null: false
20
+ field :status, Types::IdentityProviderStatus, null: false
21
21
  field :documentation_pdf_url, String, null: true
22
22
 
23
- def configured
24
- !!(@object.sso_url && @object.sso_cert)
25
- end
26
-
27
23
  def documentation_pdf_url
28
24
  ENV['BASE_URL'] + '/identity_provider/documentation/' + @object.id
29
25
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Osso
4
+ module GraphQL
5
+ module Types
6
+ class IdentityProviderStatus < BaseEnum
7
+ value('Pending', value: 'PENDING')
8
+ value('Configured', value: 'CONFIGURED')
9
+ value('Active', value: 'ACTIVE')
10
+ value('Error', value: 'ERROR')
11
+ end
12
+ end
13
+ end
14
+ end
@@ -8,6 +8,8 @@ module Osso
8
8
  belongs_to :enterprise_account
9
9
  belongs_to :oauth_client
10
10
  has_many :users
11
+ before_save :set_status
12
+
11
13
 
12
14
  def name
13
15
  service.titlecase
@@ -43,6 +45,12 @@ module Osso
43
45
  end
44
46
 
45
47
  alias acs_url assertion_consumer_service_url
48
+
49
+ def set_status
50
+ return if status != 'PENDING'
51
+
52
+ self.status = 'CONFIGURED' if sso_url && sso_cert
53
+ end
46
54
  end
47
55
  end
48
56
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Osso
4
- VERSION = '0.0.3.7'
4
+ VERSION = '0.0.3.8'
5
5
  end
@@ -23,7 +23,7 @@ describe Osso::GraphQL::Schema do
23
23
  identityProvider {
24
24
  id
25
25
  domain
26
- configured
26
+ status
27
27
  enterpriseAccountId
28
28
  service
29
29
  acsUrl
@@ -46,8 +46,8 @@ describe Osso::GraphQL::Schema do
46
46
  describe 'for an admin user' do
47
47
  let(:current_scope) { :admin }
48
48
  it 'configures an identity provider' do
49
- expect(subject.dig('data', 'configureIdentityProvider', 'identityProvider', 'configured')).
50
- to be true
49
+ expect(subject.dig('data', 'configureIdentityProvider', 'identityProvider', 'status')).
50
+ to eq('configured')
51
51
  end
52
52
  end
53
53
 
@@ -19,7 +19,7 @@ describe Osso::GraphQL::Schema do
19
19
  acsUrl
20
20
  ssoCert
21
21
  ssoUrl
22
- configured
22
+ status
23
23
  }
24
24
  name
25
25
  status
@@ -22,7 +22,7 @@ describe Osso::GraphQL::Schema do
22
22
  acsUrl
23
23
  ssoCert
24
24
  ssoUrl
25
- configured
25
+ status
26
26
  }
27
27
  name
28
28
  status
@@ -17,7 +17,7 @@ describe Osso::GraphQL::Schema do
17
17
  acsUrl
18
18
  ssoCert
19
19
  ssoUrl
20
- configured
20
+ status
21
21
  }
22
22
  }
23
23
  GRAPHQL
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.7
4
+ version: 0.0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Bauch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-21 00:00:00.000000000 Z
11
+ date: 2020-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -250,6 +250,7 @@ files:
250
250
  - lib/osso/db/migrate/20200714223226_add_identity_provider_service_enum.rb
251
251
  - lib/osso/db/migrate/20200715154211_rename_idp_fields_on_identity_provider_to_sso.rb
252
252
  - lib/osso/db/migrate/20200715205801_add_name_to_enterprise_account.rb
253
+ - lib/osso/db/migrate/20200722230116_add_identity_provider_status_enum_and_use_on_identity_providers.rb
253
254
  - lib/osso/graphql/.DS_Store
254
255
  - lib/osso/graphql/mutation.rb
255
256
  - lib/osso/graphql/mutations.rb
@@ -271,6 +272,7 @@ files:
271
272
  - lib/osso/graphql/types/enterprise_account.rb
272
273
  - lib/osso/graphql/types/identity_provider.rb
273
274
  - lib/osso/graphql/types/identity_provider_service.rb
275
+ - lib/osso/graphql/types/identity_provider_status.rb
274
276
  - lib/osso/graphql/types/oauth_client.rb
275
277
  - lib/osso/graphql/types/user.rb
276
278
  - lib/osso/helpers/auth.rb