openstax_accounts 9.5.1 → 9.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3bbc4f9d4b0e45a223ac13d149012a2f27fc8ab8b77d71aa2213f447974ae0ee
4
- data.tar.gz: fed8b3ecbf12bbd0cf45ca9f11a0e73a98c4a4157f97733ce3b2672ecb8bc7ff
3
+ metadata.gz: 3cd4aa7a22ea69ad3166b90650c73a63b0bcdf5b029bb6d1d3405d45c3769fdc
4
+ data.tar.gz: 4d0308a4b059dc5d4f81042995d930f60a571c44f6bdf432f9718b771f198b75
5
5
  SHA512:
6
- metadata.gz: eaf4336be588df387e67d9f79633f398053f655c10d624f29d2d0dfe027854a5def31a12c70e088edd7069633762c12707e481cf078e12ea9a389d98b43658be
7
- data.tar.gz: 98a1fd1915f40aaf349112a28d91a359cc5ec2b8fbeb230d7192e423b07aaab0a65a367367c400bf2ac3ed3180158561a3abcd9a4e930ea6e2c0af18e0dc88d3
6
+ metadata.gz: 9594b3dfa88ac6e1a79ab3c75e13a895eea7661827050c61f7573983a44696a69a29d0433dc23937a3ff18d745ec1e52e15dba01682be7d095ff2dcc5aaa62cd
7
+ data.tar.gz: d808626f78220265082eaac3855b4f47700c843d0e36564ff67e4e3e6194790fca1c9497aab2093ee1e8a8da8387f41603ee9ee9c2fdfe36caeaa7f247d04516
data/README.md CHANGED
@@ -2,7 +2,7 @@ accounts-rails
2
2
  =============
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/openstax_accounts.svg)](http://badge.fury.io/rb/openstax_accounts)
5
- [![Build Status](https://travis-ci.org/openstax/accounts-rails.svg?branch=master)](https://travis-ci.org/openstax/accounts-rails)
5
+ [![Tests](https://github.com/openstax/accounts-rails/workflows/Tests/badge.svg)](https://github.com/openstax/accounts-rails/actions?query=workflow:Tests)
6
6
  [![Code Climate](https://codeclimate.com/github/openstax/accounts-rails/badges/gpa.svg)](https://codeclimate.com/github/openstax/accounts-rails)
7
7
 
8
8
  A rails engine for interfacing with OpenStax's accounts server.
@@ -190,3 +190,8 @@ In that folder's config folder, create a `secret_settings.yml` file according to
190
190
  instructions in `secret_settings.yml.example`. Run the example server in the normal way (bundle install..., migrate db, rails server).
191
191
  7. Navigate to the home page, http://localhost:4000. Click log in and play around. You can also refresh the accounts site and see yourself logged in, log out, etc.
192
192
  8. For fun, change example/config/openstax_accounts.rb to set `enable_stubbing` to `true`. Now when you click login you'll be taken to a developer-only page where you can login as other users, generate new users, create new users, etc.
193
+
194
+ Additional Documentation
195
+ ------------------------
196
+
197
+ Additional documentation is in the [accounts-rails wiki](https://github.com/openstax/accounts-rails/wiki).
@@ -47,7 +47,7 @@ module OpenStax
47
47
 
48
48
  def profile
49
49
  # TODO: stub profile if stubbing is enabled
50
- redirect_to URI.join(configuration.openstax_accounts_url, '/profile').to_s
50
+ redirect_to URI.join(configuration.openstax_accounts_url, 'profile').to_s
51
51
  end
52
52
  end
53
53
  end
@@ -5,6 +5,7 @@ module OpenStax::Accounts
5
5
  SYNC_ATTRIBUTES = [
6
6
  :openstax_uid,
7
7
  :username,
8
+ :is_administrator,
8
9
  :first_name,
9
10
  :last_name,
10
11
  :full_name,
@@ -30,6 +30,12 @@ module OpenStax
30
30
  required: true
31
31
  }
32
32
 
33
+ property :is_administrator,
34
+ type: :boolean,
35
+ schema_info: {
36
+ description: 'Whether or not this user is an administrator on Accounts'
37
+ }
38
+
33
39
  property :first_name,
34
40
  type: String,
35
41
  schema_info: {
@@ -1,3 +1,5 @@
1
+ require 'openstax_api'
2
+
1
3
  module OpenStax
2
4
  module Accounts
3
5
  module Api
@@ -8,7 +8,7 @@ module OpenStax
8
8
  uid = attrs.delete('id')
9
9
  uuid = attrs.delete('uuid')
10
10
  account = Account.find_or_initialize_by(uuid: uuid)
11
- account.update_attributes!(attrs.slice(*Account.column_names))
11
+ account.update!(attrs.slice(*Account.column_names))
12
12
  transfer_errors_from(account, {type: :verbatim})
13
13
  outputs.account = account
14
14
  end
data/config/routes.rb CHANGED
@@ -17,8 +17,8 @@ OpenStax::Accounts::Engine.routes.draw do
17
17
 
18
18
  # OmniAuth local routes (SessionsController)
19
19
  scope module: 'sessions' do
20
- get 'auth/:provider/callback', action: :callback, as: :callback # Authentication success
21
- get 'auth/failure', action: :failure, as: :failure # Authentication failure
20
+ get 'auth/openstax/callback', action: :callback, as: :callback # Authentication success
21
+ get 'auth/failure', action: :failure, as: :failure # Authentication failure
22
22
 
23
23
  get 'login', action: :new # Redirects to /auth/openstax or stub
24
24
  match 'logout', action: :destroy, # Redirects to logout path or stub
@@ -0,0 +1,5 @@
1
+ class AddIsAdministratorToOpenStaxAccountsAccounts < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :openstax_accounts_accounts, :is_administrator, :boolean
4
+ end
5
+ end
@@ -4,11 +4,11 @@ require 'omniauth-oauth2'
4
4
  module OmniAuth
5
5
  module Strategies
6
6
  class Openstax < OAuth2
7
- option :name, "openstax"
7
+ option :name, 'openstax'
8
8
 
9
9
  option :client_options, {
10
- site: "http://accounts.openstax.org",
11
- authorize_url: "/oauth/authorize"
10
+ authorize_url: 'oauth/authorize',
11
+ token_url: 'oauth/token'
12
12
  }
13
13
 
14
14
  uid { raw_info[:uuid] }
@@ -21,9 +21,8 @@ module OmniAuth
21
21
  extra { { raw_info: raw_info } }
22
22
 
23
23
  def raw_info
24
- @raw_info ||= access_token.get('/api/user.json').parsed.symbolize_keys
24
+ @raw_info ||= access_token.get('api/user.json').parsed.symbolize_keys
25
25
  end
26
-
27
26
  end
28
27
  end
29
28
  end
@@ -1,7 +1,6 @@
1
1
  module OpenStax
2
2
  module Accounts
3
3
  module Api
4
-
5
4
  DEFAULT_API_VERSION = :v1
6
5
 
7
6
  # Executes an OpenStax Accounts API request,
@@ -113,10 +112,11 @@ module OpenStax
113
112
  @client ||= OAuth2::Client.new(
114
113
  OpenStax::Accounts.configuration.openstax_application_id,
115
114
  OpenStax::Accounts.configuration.openstax_application_secret,
116
- site: OpenStax::Accounts.configuration.openstax_accounts_url
115
+ site: OpenStax::Accounts.configuration.openstax_accounts_url,
116
+ authorize_url: 'oauth/authorize',
117
+ token_url: 'oauth/token'
117
118
  )
118
119
  end
119
-
120
120
  end
121
121
  end
122
122
  end
@@ -6,8 +6,12 @@ module OpenStax
6
6
  attr_reader :openstax_accounts_url
7
7
 
8
8
  def openstax_accounts_url=(url)
9
- url.gsub!(/https|http/,'https') if !(url =~ /localhost/)
10
- url = url + "/" if url[url.size-1] != '/'
9
+ # Only localhost urls are allowed to not be https
10
+ url.sub!('http:', 'https:') unless url.start_with?('http://localhost')
11
+
12
+ # We use URL.join with this url and it needs to end in / to make relative paths work
13
+ url += '/' unless url.end_with?('/')
14
+
11
15
  @openstax_accounts_url = url
12
16
  end
13
17
 
@@ -100,7 +104,7 @@ module OpenStax
100
104
  end
101
105
 
102
106
  def default_logout_redirect_url
103
- URI.join(openstax_accounts_url, "logout").to_s
107
+ URI.join(openstax_accounts_url, 'logout').to_s
104
108
  end
105
109
 
106
110
  attr_writer :return_to_url_approver
@@ -114,7 +118,7 @@ module OpenStax
114
118
  def initialize
115
119
  @openstax_application_id = 'SET ME!'
116
120
  @openstax_application_secret = 'SET ME!'
117
- @openstax_accounts_url = 'https://accounts.openstax.org/'
121
+ @openstax_accounts_url = 'https://openstax.org/accounts'
118
122
  @enable_stubbing = true
119
123
  @logout_via = :get
120
124
  @default_errors_partial = 'openstax/accounts/shared/attention'
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Accounts
3
- VERSION = '9.5.1'
3
+ VERSION = '9.8.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,43 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_accounts
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.5.1
4
+ version: 9.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-11 00:00:00.000000000 Z
11
+ date: 2021-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '5.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '7.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - ">"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '5.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '7.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: omniauth
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - ">="
37
+ - - "<"
32
38
  - !ruby/object:Gem::Version
33
- version: '0'
39
+ version: '2.0'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - ">="
44
+ - - "<"
39
45
  - !ruby/object:Gem::Version
40
- version: '0'
46
+ version: '2.0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: omniauth-oauth2
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +92,14 @@ dependencies:
86
92
  requirements:
87
93
  - - ">="
88
94
  - !ruby/object:Gem::Version
89
- version: '0'
95
+ version: '1.0'
90
96
  type: :runtime
91
97
  prerelease: false
92
98
  version_requirements: !ruby/object:Gem::Requirement
93
99
  requirements:
94
100
  - - ">="
95
101
  - !ruby/object:Gem::Version
96
- version: '0'
102
+ version: '1.0'
97
103
  - !ruby/object:Gem::Dependency
98
104
  name: lev
99
105
  requirement: !ruby/object:Gem::Requirement
@@ -344,6 +350,7 @@ files:
344
350
  - db/migrate/16_add_is_kip_to_openstax_accounts_accounts.rb
345
351
  - db/migrate/17_add_school_location_to_openstax_accounts_accounts.rb
346
352
  - db/migrate/18_add_grant_tutor_access_to_openstax_accounts_accounts.rb
353
+ - db/migrate/19_add_is_administrator_to_openstax_accounts_accounts.rb
347
354
  - db/migrate/1_create_openstax_accounts_groups.rb
348
355
  - db/migrate/2_create_openstax_accounts_group_members.rb
349
356
  - db/migrate/3_create_openstax_accounts_group_owners.rb
@@ -371,7 +378,7 @@ files:
371
378
  homepage: http://github.com/openstax/accounts-rails
372
379
  licenses: []
373
380
  metadata: {}
374
- post_install_message:
381
+ post_install_message:
375
382
  rdoc_options: []
376
383
  require_paths:
377
384
  - lib
@@ -386,8 +393,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
386
393
  - !ruby/object:Gem::Version
387
394
  version: '0'
388
395
  requirements: []
389
- rubygems_version: 3.0.3
390
- signing_key:
396
+ rubygems_version: 3.1.4
397
+ signing_key:
391
398
  specification_version: 4
392
399
  summary: Rails common code and bindings for the 'accounts' API
393
400
  test_files: []