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 +4 -4
- data/README.md +6 -1
- data/app/controllers/openstax/accounts/sessions_controller.rb +1 -1
- data/app/models/openstax/accounts/account.rb +1 -0
- data/app/representers/openstax/accounts/api/v1/account_representer.rb +6 -0
- data/app/representers/openstax/accounts/api/v1/account_search_representer.rb +2 -0
- data/app/routines/openstax/accounts/find_or_create_from_sso.rb +1 -1
- data/config/routes.rb +2 -2
- data/db/migrate/19_add_is_administrator_to_openstax_accounts_accounts.rb +5 -0
- data/lib/omniauth/strategies/openstax.rb +4 -5
- data/lib/openstax/accounts/api.rb +3 -3
- data/lib/openstax/accounts/configuration.rb +8 -4
- data/lib/openstax/accounts/version.rb +1 -1
- metadata +21 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cd4aa7a22ea69ad3166b90650c73a63b0bcdf5b029bb6d1d3405d45c3769fdc
|
4
|
+
data.tar.gz: 4d0308a4b059dc5d4f81042995d930f60a571c44f6bdf432f9718b771f198b75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
[](http://badge.fury.io/rb/openstax_accounts)
|
5
|
-
[](https://github.com/openstax/accounts-rails/actions?query=workflow:Tests)
|
6
6
|
[](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).
|
@@ -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: {
|
@@ -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.
|
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
|
21
|
-
get 'auth/failure', action: :failure, as: :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
|
@@ -4,11 +4,11 @@ require 'omniauth-oauth2'
|
|
4
4
|
module OmniAuth
|
5
5
|
module Strategies
|
6
6
|
class Openstax < OAuth2
|
7
|
-
option :name,
|
7
|
+
option :name, 'openstax'
|
8
8
|
|
9
9
|
option :client_options, {
|
10
|
-
|
11
|
-
|
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('
|
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
|
-
|
10
|
-
url
|
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,
|
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://
|
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'
|
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.
|
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:
|
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.
|
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: []
|