Skip to content

Commit 5f7d012

Browse files
authored
Merge pull request #1114 from ElixirTeSS/learning-path-curator-role-fix
Learning path curator role fix
2 parents ef14f70 + 805b74e commit 5f7d012

7 files changed

Lines changed: 63 additions & 50 deletions

File tree

.github/workflows/docker-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ jobs:
1414
cp config/tess.example.yml config/tess.yml
1515
cp config/secrets.example.yml config/secrets.yml
1616
- name: Build
17-
run: docker compose build test
17+
run: docker compose --profile test build test
1818
- name: Test
19-
run: docker compose run test
19+
run: docker compose --profile test run test

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ gem 'simple_token_authentication'
6262
gem 'sitemap_generator'
6363
gem 'sitemap-parser'
6464
gem 'slim'
65-
gem 'sunspot_rails', github: 'sunspot/sunspot', branch: 'master' # Contains Ruby 3 fixes that are not released
65+
gem 'sunspot_rails'
6666
gem 'terser'
6767
gem 'tess_rdf_extractors', git: 'https://github.com/ElixirTeSS/TeSS_RDF_Extractors', branch: 'master'
6868
gem 'turbolinks'

Gemfile.lock

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,6 @@ GIT
66
tess_rdf_extractors (1.1.0)
77
linkeddata (~> 3.2.0)
88

9-
GIT
10-
remote: https://github.com/sunspot/sunspot.git
11-
revision: 678c5b2b57d3b06b9432307f00283ecc6c85ad4d
12-
branch: master
13-
specs:
14-
sunspot (2.6.0)
15-
pr_geohash (~> 1.0)
16-
rsolr (>= 1.1.1, < 3)
17-
sunspot_rails (2.6.0)
18-
rails (>= 5)
19-
sunspot (= 2.6.0)
20-
219
GEM
2210
remote: https://rails-assets.org/
2311
specs:
@@ -138,12 +126,12 @@ GEM
138126
base64 (0.1.2)
139127
bcp47_spec (0.2.1)
140128
bcrypt (3.1.20)
141-
benchmark (0.4.0)
129+
benchmark (0.4.1)
142130
better_errors (2.10.1)
143131
erubi (>= 1.0.0)
144132
rack (>= 0.9.0)
145133
rouge (>= 1.0.0)
146-
bigdecimal (3.1.9)
134+
bigdecimal (3.2.2)
147135
bindata (2.5.0)
148136
bindex (0.8.1)
149137
binding_of_caller (1.0.0)
@@ -170,8 +158,8 @@ GEM
170158
json_schema (~> 0.14, >= 0.14.3)
171159
openapi_parser (~> 1.0)
172160
rack (>= 1.5)
173-
concurrent-ruby (1.3.4)
174-
connection_pool (2.5.0)
161+
concurrent-ruby (1.3.5)
162+
connection_pool (2.5.3)
175163
countries (5.6.0)
176164
unaccent (~> 0.3)
177165
country_select (8.0.2)
@@ -195,28 +183,31 @@ GEM
195183
docile (1.4.0)
196184
domain_name (0.5.20190701)
197185
unf (>= 0.0.5, < 1.0.0)
198-
drb (2.2.1)
186+
drb (2.2.3)
199187
ebnf (2.4.0)
200188
htmlentities (~> 4.3)
201189
rdf (~> 3.3)
202190
scanf (~> 1.0)
203191
sxp (~> 1.3)
204192
unicode-types (~> 1.8)
193+
erb (5.0.1)
205194
erubi (1.13.1)
206195
ethon (0.16.0)
207196
ffi (>= 1.15.0)
208197
event_stream_parser (1.0.0)
209198
eventbrite_sdk (3.6.0)
210199
rest-client (~> 2.0)
211200
execjs (2.8.1)
212-
faraday (2.9.0)
213-
faraday-net_http (>= 2.0, < 3.2)
201+
faraday (2.13.1)
202+
faraday-net_http (>= 2.0, < 3.5)
203+
json
204+
logger
214205
faraday-follow_redirects (0.3.0)
215206
faraday (>= 1, < 3)
216207
faraday-multipart (1.1.0)
217208
multipart-post (~> 2.0)
218-
faraday-net_http (3.1.0)
219-
net-http
209+
faraday-net_http (3.4.0)
210+
net-http (>= 0.5.0)
220211
ffi (1.15.5)
221212
font-awesome-sass (4.7.0)
222213
sass (>= 3.2)
@@ -245,15 +236,16 @@ GEM
245236
httparty (0.21.0)
246237
mini_mime (>= 1.0.0)
247238
multi_xml (>= 0.5.2)
248-
i18n (1.14.6)
239+
i18n (1.14.7)
249240
concurrent-ruby (~> 1.0)
250241
i18n_data (0.17.1)
251242
simple_po_parser (~> 1.1)
252243
icalendar (2.9.0)
253244
ice_cube (~> 0.16)
254245
ice_cube (0.16.4)
255246
io-console (0.8.0)
256-
irb (1.14.3)
247+
irb (1.15.2)
248+
pp (>= 0.6.0)
257249
rdoc (>= 4.0.0)
258250
reline (>= 0.4.2)
259251
iso_country_codes (0.7.8)
@@ -270,7 +262,7 @@ GEM
270262
jquery-turbolinks (2.1.0)
271263
railties (>= 3.1.0)
272264
turbolinks
273-
json (2.6.3)
265+
json (2.12.2)
274266
json-canonicalization (1.0.0)
275267
json-jwt (1.16.6)
276268
activesupport (>= 4.2)
@@ -349,8 +341,8 @@ GEM
349341
listen (3.8.0)
350342
rb-fsevent (~> 0.10, >= 0.10.3)
351343
rb-inotify (~> 0.9, >= 0.9.10)
352-
logger (1.6.5)
353-
loofah (2.24.0)
344+
logger (1.7.0)
345+
loofah (2.24.1)
354346
crass (~> 1.0.2)
355347
nokogiri (>= 1.12.0)
356348
mail (2.8.1)
@@ -366,8 +358,8 @@ GEM
366358
mime-types-data (~> 3.2015)
367359
mime-types-data (3.2023.0808)
368360
mini_mime (1.1.5)
369-
mini_portile2 (2.8.8)
370-
minitest (5.25.4)
361+
mini_portile2 (2.8.9)
362+
minitest (5.25.5)
371363
minitest-reporters (1.6.1)
372364
ansi
373365
builder
@@ -387,18 +379,18 @@ GEM
387379
multi_xml (0.6.0)
388380
multipart-post (2.4.1)
389381
nested_form (0.3.2)
390-
net-http (0.4.1)
382+
net-http (0.6.0)
391383
uri
392384
net-http-persistent (4.0.5)
393385
connection_pool (~> 2.2)
394-
net-imap (0.5.7)
386+
net-imap (0.5.8)
395387
date
396388
net-protocol
397389
net-pop (0.1.2)
398390
net-protocol
399391
net-protocol (0.2.2)
400392
timeout
401-
net-smtp (0.5.0)
393+
net-smtp (0.5.1)
402394
net-protocol
403395
netrc (0.11.0)
404396
nio4r (2.7.4)
@@ -436,15 +428,18 @@ GEM
436428
ast (~> 2.4.1)
437429
racc
438430
pg (1.5.6)
431+
pp (0.6.2)
432+
prettyprint
439433
pr_geohash (1.0.0)
434+
prettyprint (0.2.0)
440435
private_address_check (0.5.0)
441436
pry (0.14.2)
442437
coderay (~> 1.1)
443438
method_source (~> 1.0)
444439
pry-byebug (3.10.1)
445440
byebug (~> 11.0)
446441
pry (>= 0.13, < 0.15)
447-
psych (5.2.2)
442+
psych (5.2.6)
448443
date
449444
stringio
450445
public_activity (3.0.1)
@@ -458,7 +453,7 @@ GEM
458453
pundit (2.3.1)
459454
activesupport (>= 3.0.0)
460455
racc (1.8.1)
461-
rack (2.2.14)
456+
rack (2.2.17)
462457
rack-cors (2.0.2)
463458
rack (>= 2.0.0)
464459
rack-oauth2 (2.2.0)
@@ -495,7 +490,7 @@ GEM
495490
actionpack (>= 5.0.1.rc1)
496491
actionview (>= 5.0.1.rc1)
497492
activesupport (>= 5.0.1.rc1)
498-
rails-dom-testing (2.2.0)
493+
rails-dom-testing (2.3.0)
499494
activesupport (>= 5.0.0)
500495
minitest
501496
nokogiri (>= 1.6)
@@ -521,7 +516,7 @@ GEM
521516
thor (~> 1.0, >= 1.2.2)
522517
zeitwerk (~> 2.6)
523518
rainbow (3.1.1)
524-
rake (13.2.1)
519+
rake (13.3.0)
525520
rb-fsevent (0.11.2)
526521
rb-inotify (0.10.1)
527522
ffi (~> 1.0)
@@ -590,7 +585,8 @@ GEM
590585
rdf-xsd (3.3.0)
591586
rdf (~> 3.3)
592587
rexml (~> 3.2)
593-
rdoc (6.10.0)
588+
rdoc (6.14.0)
589+
erb
594590
psych (>= 4.0.0)
595591
recaptcha (5.15.0)
596592
redcarpet (3.6.0)
@@ -599,7 +595,7 @@ GEM
599595
redis-client (0.16.0)
600596
connection_pool
601597
regexp_parser (2.8.1)
602-
reline (0.6.0)
598+
reline (0.6.1)
603599
io-console (~> 0.5)
604600
responders (3.1.1)
605601
actionpack (>= 5.2)
@@ -613,7 +609,7 @@ GEM
613609
nokogiri
614610
rexml (3.4.0)
615611
rouge (4.1.3)
616-
rsolr (2.5.0)
612+
rsolr (2.6.0)
617613
builder (>= 2.1.2)
618614
faraday (>= 0.9, < 3, != 2.0.0)
619615
rss (0.3.0)
@@ -729,7 +725,14 @@ GEM
729725
actionpack (>= 5.2)
730726
activesupport (>= 5.2)
731727
sprockets (>= 3.0.0)
732-
stringio (3.1.2)
728+
stringio (3.1.7)
729+
sunspot (2.7.1)
730+
bigdecimal
731+
pr_geohash (~> 1.0)
732+
rsolr (>= 1.1.1, < 3)
733+
sunspot_rails (2.7.1)
734+
rails (>= 5)
735+
sunspot (= 2.7.1)
733736
swd (2.0.2)
734737
activesupport (>= 3)
735738
attr_required (>= 0.0.5)
@@ -764,7 +767,7 @@ GEM
764767
unf_ext (0.0.8.2)
765768
unicode-display_width (2.4.2)
766769
unicode-types (1.10.0)
767-
uri (0.13.2)
770+
uri (1.0.3)
768771
useragent (0.16.11)
769772
validate_email (0.1.6)
770773
activemodel (>= 3.0)
@@ -789,7 +792,7 @@ GEM
789792
crack (>= 0.3.2)
790793
hashdiff (>= 0.4.0, < 2.0.0)
791794
webrick (1.9.1)
792-
websocket-driver (0.7.7)
795+
websocket-driver (0.8.0)
793796
base64
794797
websocket-extensions (>= 0.1.0)
795798
websocket-extensions (0.1.5)
@@ -801,7 +804,7 @@ GEM
801804
psych (>= 3.3)
802805
rdf (~> 3.3)
803806
rdf-xsd (~> 3.3)
804-
zeitwerk (2.7.1)
807+
zeitwerk (2.7.3)
805808

806809
PLATFORMS
807810
ruby
@@ -886,7 +889,7 @@ DEPENDENCIES
886889
sitemap-parser
887890
sitemap_generator
888891
slim
889-
sunspot_rails!
892+
sunspot_rails
890893
terser
891894
tess_rdf_extractors!
892895
turbolinks

app/policies/learning_path_topic_policy.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ def update?
55
end
66

77
def manage?
8-
curators_and_admin
8+
curators_and_admin || @user&.has_role?(:learning_path_curator)
99
end
1010

1111
def create?
12-
curators_and_admin
12+
manage?
1313
end
1414

1515
end

docker-compose-prod.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3.8'
21
services:
32
app:
43
container_name: ${PREFIX}-app

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3.8'
21
services:
32
app:
43
container_name: ${PREFIX}-app

test/controllers/learning_path_topics_controller_test.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ class LearningPathTopicsControllerTest < ActionController::TestCase
6161
get :new
6262
assert_response :success
6363

64+
sign_in users(:learning_path_curator)
65+
get :new
66+
assert_response :success
67+
6468
sign_in users(:admin)
6569
get :new
6670
assert_response :success
@@ -103,6 +107,14 @@ class LearningPathTopicsControllerTest < ActionController::TestCase
103107
assert_redirected_to learning_path_topic_path(assigns(:learning_path_topic))
104108
end
105109

110+
test 'should create learning_path_topic for learning_path_curator' do
111+
sign_in users(:learning_path_curator)
112+
assert_difference('LearningPathTopic.count') do
113+
post :create, params: { learning_path_topic: { title: @learning_path_topic.title, description: @learning_path_topic.description } }
114+
end
115+
assert_redirected_to learning_path_topic_path(assigns(:learning_path_topic))
116+
end
117+
106118
test 'should create learning_path_topic for admin' do
107119
sign_in users(:admin)
108120
assert_difference('LearningPathTopic.count') do

0 commit comments

Comments
 (0)