merge master

This commit is contained in:
Karol
2019-12-09 20:54:24 +01:00
7 changed files with 444 additions and 212 deletions

View File

@ -38,6 +38,8 @@ before_install:
install:
- bundle install --jobs=3 --retry=3 --deployment --path=${BUNDLE_PATH:-vendor/bundle}
- nvm install stable
- nvm use stable
- yarn install
before_script:

View File

@ -17,7 +17,7 @@ gem 'pg'
gem 'pry-byebug'
gem 'puma'
gem 'pundit'
gem 'rails', '5.2.3'
gem 'rails', '5.2.4'
gem 'rails-i18n'
gem 'i18n-js'
gem 'ransack'

View File

@ -22,43 +22,43 @@ GEM
remote: https://rubygems.org/
specs:
ZenTest (4.12.0)
actioncable (5.2.3)
actionpack (= 5.2.3)
actioncable (5.2.4)
actionpack (= 5.2.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
actionmailer (5.2.4)
actionpack (= 5.2.4)
actionview (= 5.2.4)
activejob (= 5.2.4)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.3)
actionview (= 5.2.3)
activesupport (= 5.2.3)
actionpack (5.2.4)
actionview (= 5.2.4)
activesupport (= 5.2.4)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.3)
activesupport (= 5.2.3)
actionview (5.2.4)
activesupport (= 5.2.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.3)
activesupport (= 5.2.3)
activejob (5.2.4)
activesupport (= 5.2.4)
globalid (>= 0.3.6)
activemodel (5.2.3)
activesupport (= 5.2.3)
activerecord (5.2.3)
activemodel (= 5.2.3)
activesupport (= 5.2.3)
activemodel (5.2.4)
activesupport (= 5.2.4)
activerecord (5.2.4)
activemodel (= 5.2.4)
activesupport (= 5.2.4)
arel (>= 9.0)
activestorage (5.2.3)
actionpack (= 5.2.3)
activerecord (= 5.2.3)
activestorage (5.2.4)
actionpack (= 5.2.4)
activerecord (= 5.2.4)
marcel (~> 0.3.1)
activesupport (5.2.3)
activesupport (5.2.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
@ -221,7 +221,7 @@ GEM
netrc (0.11.0)
newrelic_rpm (6.7.0.359)
nio4r (2.5.2)
nokogiri (1.10.5)
nokogiri (1.10.7)
mini_portile2 (~> 2.4.0)
nyan-cat-formatter (0.12.0)
rspec (>= 2.99, >= 2.14.2, < 4)
@ -261,18 +261,18 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.3)
actioncable (= 5.2.3)
actionmailer (= 5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
activemodel (= 5.2.3)
activerecord (= 5.2.3)
activestorage (= 5.2.3)
activesupport (= 5.2.3)
rails (5.2.4)
actioncable (= 5.2.4)
actionmailer (= 5.2.4)
actionpack (= 5.2.4)
actionview (= 5.2.4)
activejob (= 5.2.4)
activemodel (= 5.2.4)
activerecord (= 5.2.4)
activestorage (= 5.2.4)
activesupport (= 5.2.4)
bundler (>= 1.3.0)
railties (= 5.2.3)
railties (= 5.2.4)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.4)
actionpack (>= 5.0.1.x)
@ -289,9 +289,9 @@ GEM
rails-timeago (2.18.0)
actionpack (>= 3.1)
activesupport (>= 3.1)
railties (5.2.3)
actionpack (= 5.2.3)
activesupport (= 5.2.3)
railties (5.2.4)
actionpack (= 5.2.4)
activesupport (= 5.2.4)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
@ -481,7 +481,7 @@ DEPENDENCIES
puma
pundit
rack-mini-profiler
rails (= 5.2.3)
rails (= 5.2.4)
rails-controller-testing
rails-i18n
rails-timeago

View File

@ -26,11 +26,16 @@ class ApplicationPolicy
private :no_one
def everyone_in_study_group
if @record.respond_to? :study_group # e.g. submission
study_group = @record.study_group
return false if study_group.blank?
users_in_same_study_group = study_group.users
return false if users_in_same_study_group.blank?
else # e.g. exercise
study_groups = @record.user.study_groups
users_in_same_study_group = study_groups.collect{ |study_group|
study_group.users}.flatten
end
users_in_same_study_group.include? @user
end

View File

@ -8,7 +8,7 @@ class ExercisePolicy < AdminOrAuthorPolicy
end
[:clone?, :destroy?, :edit?, :update?, :export_external_check?, :export_external_confirm?].each do |action|
define_method(action) { admin? || author? }
define_method(action) { admin? || teacher_in_study_group || author? }
end
[:implement?, :working_times?, :intervention?, :search?, :submit?, :reload?].each do |action|

View File

@ -1,8 +1,8 @@
{
"dependencies": {
"@rails/webpacker": "4.0",
"@rails/webpacker": "4.2",
"bootstrap": "^4.1.3",
"bootswatch": "^4.1.3",
"bootswatch": "^4.4.1",
"chosen-js": "^1.8.7",
"d3": "^5.9.2",
"d3-tip": "^0.9.1",
@ -13,13 +13,13 @@
"jstree": "^3.3.8",
"opensans-webkit": "^1.0.1",
"popper.js": "^1.15.0",
"snyk": "^1.189.0",
"snyk": "^1.256.0",
"underscore": "^1.9.1",
"vis": "^4.21.0",
"webpack-merge": "^4.1.4"
},
"devDependencies": {
"webpack-dev-server": "3.4.1"
"webpack-dev-server": "3.9.0"
},
"scripts": {
"webpack": "./bin/webpack",

553
yarn.lock

File diff suppressed because it is too large Load Diff