bsm_oa 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/Gemfile +6 -0
- data/Gemfile.lock +138 -142
- data/app/controllers/bsm_oa/accounts_controller.rb +19 -4
- data/app/controllers/bsm_oa/admin_controller.rb +5 -0
- data/app/controllers/bsm_oa/applications_controller.rb +36 -15
- data/app/controllers/bsm_oa/authorizations_controller.rb +7 -6
- data/app/controllers/bsm_oa/base_controller.rb +5 -0
- data/app/controllers/bsm_oa/roles_controller.rb +3 -4
- data/app/views/bsm_oa/applications/_application.html.erb +2 -2
- data/app/views/bsm_oa/applications/_inputs.html.erb +6 -11
- data/app/views/bsm_oa/applications/edit.html.erb +2 -2
- data/app/views/bsm_oa/applications/index.html.erb +1 -1
- data/app/views/bsm_oa/applications/new.html.erb +2 -2
- data/app/views/bsm_oa/applications/show.html.erb +40 -0
- data/app/views/bsm_oa/authorizations/_inputs.html.erb +2 -2
- data/app/views/bsm_oa/authorizations/edit.html.erb +1 -1
- data/app/views/bsm_oa/authorizations/new.html.erb +2 -3
- data/app/views/bsm_oa/roles/_inputs.html.erb +3 -4
- data/app/views/bsm_oa/roles/edit.html.erb +1 -1
- data/app/views/bsm_oa/roles/new.html.erb +1 -1
- data/app/views/bsm_oa/roles/show.html.erb +1 -1
- data/bsm_oa.gemspec +6 -11
- data/db/migrate/20150507113313_bsm_oa_create_doorkeeper_tables.rb +1 -1
- data/db/migrate/20150513155732_bsm_oa_create_tables.rb +1 -1
- data/lib/bsm_oa.rb +0 -3
- data/lib/bsm_oa/application.rb +31 -0
- data/lib/bsm_oa/authorization.rb +8 -15
- data/lib/bsm_oa/config.rb +5 -0
- data/lib/bsm_oa/engine.rb +2 -4
- data/lib/bsm_oa/role.rb +1 -1
- data/lib/bsm_oa/routes.rb +29 -3
- data/lib/bsm_oa/version.rb +1 -1
- data/spec/controllers/bsm_oa/accounts_controller_spec.rb +15 -12
- data/spec/controllers/bsm_oa/applications_controller_spec.rb +22 -28
- data/spec/controllers/bsm_oa/authorizations_controller_spec.rb +17 -22
- data/spec/controllers/bsm_oa/roles_controller_spec.rb +14 -16
- data/spec/factories.rb +1 -1
- data/spec/lib/bsm_oa/{application_mixin_spec.rb → application_spec.rb} +13 -9
- data/spec/lib/bsm_oa/authorization_spec.rb +5 -9
- data/spec/lib/bsm_oa/role_spec.rb +1 -1
- data/spec/spec_helper.rb +18 -8
- metadata +22 -104
- data/app/views/bsm_oa/accounts/show.json.jbuilder +0 -7
- data/app/views/bsm_oa/applications/_application.json.jbuilder +0 -1
- data/app/views/bsm_oa/applications/create.json.jbuilder +0 -1
- data/app/views/bsm_oa/applications/index.json.jbuilder +0 -1
- data/app/views/bsm_oa/applications/show.json.jbuilder +0 -1
- data/app/views/bsm_oa/applications/update.json.jbuilder +0 -1
- data/app/views/bsm_oa/authorizations/_authorization.json.jbuilder +0 -1
- data/app/views/bsm_oa/authorizations/index.json.jbuilder +0 -1
- data/app/views/bsm_oa/authorizations/toggle.json.jbuilder +0 -1
- data/lib/bsm_oa/application_mixin.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddc376432fcee2544323684d8630c60d07850f55
|
4
|
+
data.tar.gz: 96184f746bb222c599a9ac3aba2962a544ca8f5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16dafd2b6d854c321d0d4da2412bd35d8d9c6eacd84610270598b750440362a901870836b593ed229733bfc004c5f8495e6faedae690983204e7f7ccaf068f9a
|
7
|
+
data.tar.gz: 8eb7d9eedae1e024315fe2bb9b723414a94b3500e6ca3795abbcb16224e9879755a8f0c89685abce7576a5d42d83a7bb2720b738c18b60ea71ba7d70ce9d8917
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,3 +1,9 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gemspec
|
4
|
+
|
5
|
+
# TODO! shoulda matcher support for rails5 is on a specific branch
|
6
|
+
# I needed to extract the dependency from the gemspec into the Gemfile to ensure it would include the correct one
|
7
|
+
group :test do
|
8
|
+
gem 'shoulda-matchers', git: 'https://github.com/thoughtbot/shoulda-matchers.git', branch: 'rails-5'
|
9
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,180 +1,176 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/thoughtbot/shoulda-matchers.git
|
3
|
+
revision: 4b160bd19ecca7f97d7ac22dccd5fde9b0da5a9f
|
4
|
+
branch: rails-5
|
5
|
+
specs:
|
6
|
+
shoulda-matchers (3.1.2)
|
7
|
+
activesupport (>= 4.2.0)
|
8
|
+
|
1
9
|
PATH
|
2
10
|
remote: .
|
3
11
|
specs:
|
4
|
-
bsm_oa (0.
|
5
|
-
|
6
|
-
doorkeeper (~> 3.0.0.rc)
|
12
|
+
bsm_oa (0.4.0)
|
13
|
+
doorkeeper (~> 4.2.0)
|
7
14
|
has_scope (~> 0.6)
|
8
|
-
|
9
|
-
|
10
|
-
railties (>= 4.1, < 5.0)
|
11
|
-
responders (~> 2.0)
|
12
|
-
simple_form (~> 3.1)
|
15
|
+
railties (~> 5.0)
|
16
|
+
responders (~> 2.1)
|
13
17
|
|
14
18
|
GEM
|
15
19
|
remote: https://rubygems.org/
|
16
20
|
specs:
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
actioncable (5.1.4)
|
22
|
+
actionpack (= 5.1.4)
|
23
|
+
nio4r (~> 2.0)
|
24
|
+
websocket-driver (~> 0.6.1)
|
25
|
+
actionmailer (5.1.4)
|
26
|
+
actionpack (= 5.1.4)
|
27
|
+
actionview (= 5.1.4)
|
28
|
+
activejob (= 5.1.4)
|
22
29
|
mail (~> 2.5, >= 2.5.4)
|
23
|
-
rails-dom-testing (~>
|
24
|
-
actionpack (
|
25
|
-
actionview (=
|
26
|
-
activesupport (=
|
27
|
-
rack (~>
|
28
|
-
rack-test (
|
29
|
-
rails-dom-testing (~>
|
30
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
31
|
-
actionview (
|
32
|
-
activesupport (=
|
33
|
-
builder (~> 3.1)
|
34
|
-
erubis (~> 2.7.0)
|
35
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
36
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
37
|
-
activejob (4.2.2)
|
38
|
-
activesupport (= 4.2.2)
|
39
|
-
globalid (>= 0.3.0)
|
40
|
-
activemodel (4.2.2)
|
41
|
-
activesupport (= 4.2.2)
|
30
|
+
rails-dom-testing (~> 2.0)
|
31
|
+
actionpack (5.1.4)
|
32
|
+
actionview (= 5.1.4)
|
33
|
+
activesupport (= 5.1.4)
|
34
|
+
rack (~> 2.0)
|
35
|
+
rack-test (>= 0.6.3)
|
36
|
+
rails-dom-testing (~> 2.0)
|
37
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
38
|
+
actionview (5.1.4)
|
39
|
+
activesupport (= 5.1.4)
|
42
40
|
builder (~> 3.1)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
41
|
+
erubi (~> 1.4)
|
42
|
+
rails-dom-testing (~> 2.0)
|
43
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
44
|
+
activejob (5.1.4)
|
45
|
+
activesupport (= 5.1.4)
|
46
|
+
globalid (>= 0.3.6)
|
47
|
+
activemodel (5.1.4)
|
48
|
+
activesupport (= 5.1.4)
|
49
|
+
activerecord (5.1.4)
|
50
|
+
activemodel (= 5.1.4)
|
51
|
+
activesupport (= 5.1.4)
|
52
|
+
arel (~> 8.0)
|
53
|
+
activesupport (5.1.4)
|
54
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
48
55
|
i18n (~> 0.7)
|
49
|
-
json (~> 1.7, >= 1.7.7)
|
50
56
|
minitest (~> 5.1)
|
51
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
52
57
|
tzinfo (~> 1.1)
|
53
|
-
arel (
|
54
|
-
|
55
|
-
|
56
|
-
activerecord (>= 4.1.0, < 5.0.0)
|
57
|
-
railties (>= 4.1.0, < 5.0.0)
|
58
|
-
builder (3.2.2)
|
59
|
-
combustion (0.5.3)
|
58
|
+
arel (8.0.0)
|
59
|
+
builder (3.2.3)
|
60
|
+
combustion (0.7.0)
|
60
61
|
activesupport (>= 3.0.0)
|
61
62
|
railties (>= 3.0.0)
|
62
63
|
thor (>= 0.14.6)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
concurrent-ruby (1.0.5)
|
65
|
+
database_cleaner (1.6.1)
|
66
|
+
diff-lcs (1.3)
|
67
|
+
doorkeeper (4.2.6)
|
68
|
+
railties (>= 4.2)
|
69
|
+
erubi (1.6.1)
|
70
|
+
factory_girl (4.8.0)
|
69
71
|
activesupport (>= 3.0.0)
|
70
|
-
faker (1.4
|
72
|
+
faker (1.8.4)
|
71
73
|
i18n (~> 0.5)
|
72
|
-
globalid (0.
|
73
|
-
activesupport (>= 4.
|
74
|
-
has_scope (0.
|
75
|
-
actionpack (>=
|
76
|
-
activesupport (>=
|
77
|
-
i18n (0.
|
78
|
-
|
79
|
-
activesupport (>= 3.0.0, < 5)
|
80
|
-
multi_json (~> 1.2)
|
81
|
-
jquery-rails (4.0.4)
|
82
|
-
rails-dom-testing (~> 1.0)
|
83
|
-
railties (>= 4.2.0)
|
84
|
-
thor (>= 0.14, < 2.0)
|
85
|
-
json (1.8.3)
|
86
|
-
json_spec (1.1.4)
|
87
|
-
multi_json (~> 1.0)
|
88
|
-
rspec (>= 2.0, < 4.0)
|
89
|
-
loofah (2.0.2)
|
74
|
+
globalid (0.4.0)
|
75
|
+
activesupport (>= 4.2.0)
|
76
|
+
has_scope (0.7.1)
|
77
|
+
actionpack (>= 4.1, < 5.2)
|
78
|
+
activesupport (>= 4.1, < 5.2)
|
79
|
+
i18n (0.8.6)
|
80
|
+
loofah (2.0.3)
|
90
81
|
nokogiri (>= 1.5.9)
|
91
|
-
mail (2.6.
|
92
|
-
mime-types (>= 1.16, <
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
82
|
+
mail (2.6.6)
|
83
|
+
mime-types (>= 1.16, < 4)
|
84
|
+
method_source (0.8.2)
|
85
|
+
mime-types (3.1)
|
86
|
+
mime-types-data (~> 3.2015)
|
87
|
+
mime-types-data (3.2016.0521)
|
88
|
+
mini_portile2 (2.2.0)
|
89
|
+
minitest (5.10.3)
|
90
|
+
nio4r (2.1.0)
|
91
|
+
nokogiri (1.8.0)
|
92
|
+
mini_portile2 (~> 2.2.0)
|
93
|
+
rack (2.0.3)
|
94
|
+
rack-test (0.7.0)
|
95
|
+
rack (>= 1.0, < 3)
|
96
|
+
rails (5.1.4)
|
97
|
+
actioncable (= 5.1.4)
|
98
|
+
actionmailer (= 5.1.4)
|
99
|
+
actionpack (= 5.1.4)
|
100
|
+
actionview (= 5.1.4)
|
101
|
+
activejob (= 5.1.4)
|
102
|
+
activemodel (= 5.1.4)
|
103
|
+
activerecord (= 5.1.4)
|
104
|
+
activesupport (= 5.1.4)
|
105
|
+
bundler (>= 1.3.0)
|
106
|
+
railties (= 5.1.4)
|
107
|
+
sprockets-rails (>= 2.0.0)
|
108
|
+
rails-controller-testing (1.0.2)
|
109
|
+
actionpack (~> 5.x, >= 5.0.1)
|
110
|
+
actionview (~> 5.x, >= 5.0.1)
|
111
|
+
activesupport (~> 5.x)
|
112
|
+
rails-dom-testing (2.0.3)
|
113
|
+
activesupport (>= 4.2.0)
|
114
|
+
nokogiri (>= 1.6)
|
115
|
+
rails-html-sanitizer (1.0.3)
|
120
116
|
loofah (~> 2.0)
|
121
|
-
railties (
|
122
|
-
actionpack (=
|
123
|
-
activesupport (=
|
117
|
+
railties (5.1.4)
|
118
|
+
actionpack (= 5.1.4)
|
119
|
+
activesupport (= 5.1.4)
|
120
|
+
method_source
|
124
121
|
rake (>= 0.8.7)
|
125
122
|
thor (>= 0.18.1, < 2.0)
|
126
|
-
rake (
|
127
|
-
responders (2.
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
rspec-
|
132
|
-
|
133
|
-
rspec-core (3.3.1)
|
134
|
-
rspec-support (~> 3.3.0)
|
135
|
-
rspec-expectations (3.3.0)
|
123
|
+
rake (12.1.0)
|
124
|
+
responders (2.4.0)
|
125
|
+
actionpack (>= 4.2.0, < 5.3)
|
126
|
+
railties (>= 4.2.0, < 5.3)
|
127
|
+
rspec-core (3.6.0)
|
128
|
+
rspec-support (~> 3.6.0)
|
129
|
+
rspec-expectations (3.6.0)
|
136
130
|
diff-lcs (>= 1.2.0, < 2.0)
|
137
|
-
rspec-support (~> 3.
|
138
|
-
rspec-mocks (3.
|
131
|
+
rspec-support (~> 3.6.0)
|
132
|
+
rspec-mocks (3.6.0)
|
139
133
|
diff-lcs (>= 1.2.0, < 2.0)
|
140
|
-
rspec-support (~> 3.
|
141
|
-
rspec-rails (3.
|
142
|
-
actionpack (>= 3.0, < 4.3)
|
143
|
-
activesupport (>= 3.0, < 4.3)
|
144
|
-
railties (>= 3.0, < 4.3)
|
145
|
-
rspec-core (~> 3.3.0)
|
146
|
-
rspec-expectations (~> 3.3.0)
|
147
|
-
rspec-mocks (~> 3.3.0)
|
148
|
-
rspec-support (~> 3.3.0)
|
149
|
-
rspec-support (3.3.0)
|
150
|
-
shoulda-matchers (2.8.0)
|
151
|
-
activesupport (>= 3.0.0)
|
152
|
-
simple_form (3.1.0)
|
153
|
-
actionpack (~> 4.0)
|
154
|
-
activemodel (~> 4.0)
|
155
|
-
sprockets (3.2.0)
|
156
|
-
rack (~> 1.0)
|
157
|
-
sprockets-rails (2.3.1)
|
134
|
+
rspec-support (~> 3.6.0)
|
135
|
+
rspec-rails (3.6.1)
|
158
136
|
actionpack (>= 3.0)
|
159
137
|
activesupport (>= 3.0)
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
138
|
+
railties (>= 3.0)
|
139
|
+
rspec-core (~> 3.6.0)
|
140
|
+
rspec-expectations (~> 3.6.0)
|
141
|
+
rspec-mocks (~> 3.6.0)
|
142
|
+
rspec-support (~> 3.6.0)
|
143
|
+
rspec-support (3.6.0)
|
144
|
+
sprockets (3.7.1)
|
145
|
+
concurrent-ruby (~> 1.0)
|
146
|
+
rack (> 1, < 3)
|
147
|
+
sprockets-rails (3.2.1)
|
148
|
+
actionpack (>= 4.0)
|
149
|
+
activesupport (>= 4.0)
|
150
|
+
sprockets (>= 3.0.0)
|
151
|
+
sqlite3 (1.3.13)
|
152
|
+
thor (0.20.0)
|
153
|
+
thread_safe (0.3.6)
|
154
|
+
tzinfo (1.2.3)
|
165
155
|
thread_safe (~> 0.1)
|
156
|
+
websocket-driver (0.6.5)
|
157
|
+
websocket-extensions (>= 0.1.0)
|
158
|
+
websocket-extensions (0.1.2)
|
166
159
|
|
167
160
|
PLATFORMS
|
168
161
|
ruby
|
169
162
|
|
170
163
|
DEPENDENCIES
|
171
164
|
bsm_oa!
|
172
|
-
combustion (~> 0.
|
165
|
+
combustion (~> 0.7.0)
|
173
166
|
database_cleaner
|
174
167
|
factory_girl
|
175
168
|
faker
|
176
|
-
|
177
|
-
rails
|
169
|
+
rails (>= 5.0)
|
170
|
+
rails-controller-testing
|
178
171
|
rspec-rails
|
179
|
-
shoulda-matchers
|
172
|
+
shoulda-matchers!
|
180
173
|
sqlite3
|
174
|
+
|
175
|
+
BUNDLED WITH
|
176
|
+
1.14.5
|
@@ -1,12 +1,27 @@
|
|
1
1
|
module BsmOa
|
2
|
-
class AccountsController <
|
2
|
+
class AccountsController < ActionController::Metal
|
3
|
+
include AbstractController::Callbacks
|
4
|
+
include ActionController::Head
|
5
|
+
include Doorkeeper::Rails::Helpers
|
6
|
+
|
3
7
|
before_action :doorkeeper_authorize!
|
4
|
-
respond_to :json
|
5
8
|
|
6
9
|
# GET /me.json
|
7
10
|
def show
|
8
|
-
|
9
|
-
|
11
|
+
self.content_type = Mime[:json]
|
12
|
+
self.response_body = account.respond_to?(:oa_json) ? account.oa_json : account.to_json
|
10
13
|
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def valid_doorkeeper_token?
|
18
|
+
!!account && super
|
19
|
+
end
|
20
|
+
|
21
|
+
def account
|
22
|
+
return @_account if defined?(@_account)
|
23
|
+
@_account = BsmOa.config.user_class.find_by_id doorkeeper_token.try(:resource_owner_id)
|
24
|
+
end
|
25
|
+
|
11
26
|
end
|
12
27
|
end
|
@@ -1,34 +1,55 @@
|
|
1
1
|
module BsmOa
|
2
|
-
class ApplicationsController <
|
3
|
-
respond_to :html
|
4
|
-
|
2
|
+
class ApplicationsController < AdminController
|
3
|
+
respond_to :html
|
4
|
+
respond_to :json, except: [:new, :edit]
|
5
|
+
has_scope :ordered, default: true, only: [:index]
|
6
|
+
|
7
|
+
def index
|
8
|
+
@applications = apply_scopes(resource_scope)
|
9
|
+
respond_with @applications
|
10
|
+
end
|
11
|
+
|
12
|
+
def show
|
13
|
+
respond_with resource
|
14
|
+
end
|
15
|
+
|
16
|
+
def new
|
17
|
+
@application = resource_scope.new
|
18
|
+
respond_with @application
|
19
|
+
end
|
20
|
+
|
21
|
+
def edit
|
22
|
+
respond_with resource
|
23
|
+
end
|
5
24
|
|
6
25
|
def create
|
7
|
-
@application =
|
8
|
-
|
9
|
-
respond_with @application, location: location
|
26
|
+
@application = resource_scope.create permitted_params
|
27
|
+
respond_with @application
|
10
28
|
end
|
11
29
|
|
12
30
|
def update
|
13
|
-
|
14
|
-
respond_with
|
31
|
+
resource.update(permitted_params)
|
32
|
+
respond_with resource
|
15
33
|
end
|
16
34
|
|
17
35
|
def destroy
|
18
|
-
|
36
|
+
resource.destroy
|
37
|
+
respond_with resource, location: bsm_oa_applications_path
|
19
38
|
end
|
20
39
|
|
21
40
|
protected
|
22
41
|
|
23
|
-
def
|
24
|
-
|
42
|
+
def resource
|
43
|
+
@application ||= resource_scope.find params[:id]
|
25
44
|
end
|
26
45
|
|
27
|
-
|
28
|
-
|
46
|
+
# @return [ActiveRecord::Relation]
|
47
|
+
def resource_scope
|
48
|
+
BsmOa::Application.all
|
49
|
+
end
|
29
50
|
|
30
|
-
|
31
|
-
|
51
|
+
def permitted_params
|
52
|
+
params.require(:bsm_oa_application).permit(:name, :redirect_uri, :permissions, :uid, :secret)
|
32
53
|
end
|
33
54
|
|
34
55
|
end
|