From 135e7b4dfc6ed8b929af57f4c7390d638be9e571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 12 Nov 2015 16:56:50 +0100 Subject: [PATCH 1/2] Use Core PermittedParams to add new strong_param key --- app/controllers/principal_roles_controller.rb | 2 +- lib/open_project/global_roles/engine.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/principal_roles_controller.rb b/app/controllers/principal_roles_controller.rb index 65ea08f449..990098631d 100644 --- a/app/controllers/principal_roles_controller.rb +++ b/app/controllers/principal_roles_controller.rb @@ -147,6 +147,6 @@ class PrincipalRolesController < ApplicationController private def principle_role_params - params.require(:principal_role).permit(:principal_id, :role_id, role_ids: []) + params.require(:principal_role).permit(*PermittedParams.permitted_attributes[:global_roles_principal_role]) end end diff --git a/lib/open_project/global_roles/engine.rb b/lib/open_project/global_roles/engine.rb index 691478a8d7..1812ecc914 100644 --- a/lib/open_project/global_roles/engine.rb +++ b/lib/open_project/global_roles/engine.rb @@ -33,6 +33,10 @@ module OpenProject::GlobalRoles patches [:Principal, :Role, :User, :RolesController, :UsersController, :RolesHelper, :UsersHelper] + + global_roles_attributes = [:id, :principal_id, :role_id, role_ids: []] + additional_permitted_attributes global_roles_principal_role: global_roles_attributes + initializer 'global_roles.patch_access_control' do require 'open_project/global_roles/patches/access_control_patch' require 'open_project/global_roles/patches/permission_patch' From 3132a00d430381a66c7de6b2ee287f1fe3916cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 12 Nov 2015 19:04:09 +0100 Subject: [PATCH 2/2] Let travis run plugin specs and cukes --- .travis.yml | 111 ++++++++++++++++++++++++++++++++++++++++++++++++ Gemfile.plugins | 7 +++ 2 files changed, 118 insertions(+) create mode 100644 .travis.yml create mode 100644 Gemfile.plugins diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..fba2a7a082 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,111 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2012-2015 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2013 Jean-Philippe Lang +# Copyright (C) 2010-2013 the ChiliProject Team +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + +# Travis configuration based on the respective OpenProject core configuration. +# Everything save for the matrix section and additional `before_install` +# instructions is copied and pasted from the core. + +language: ruby + +rvm: + - 2.2.3 + +sudo: false + +cache: + - bundler: true + - directories: + - frontend/node_modules + - frontend/bower_components + +bundler_args: --without development production + +branches: + only: + - master + - dev + - /^(stable|release)\/.*$/ + +env: + global: + - CI=true + - RAILS_ENV=test + - COVERAGE=true + + matrix: + - "TEST_SUITE=plugins:spec DB=mysql" + - "TEST_SUITE=plugins:cucumber DB=mysql" + +before_install: + # Custom plugin instructions follow. + + # Move the plugin into a subfolder. The plugin-provided Gemfile.plugins + # must refer to this folder. + - mkdir -p plugins/this + - echo `ls -a | tail -n+3 | grep -v plugins` plugins/this/ | xargs mv + + # Get OpenProject. + # Doing the fetch detour as you cannot clone into the current directory. + - git init + - git remote add openproject https://github.com/opf/openproject.git + - git fetch --depth=1 openproject + - git checkout openproject/dev + + # End of custom plugin instructions. + + - "echo `firefox -v`" + - "export DISPLAY=:99.0" + - "/sbin/start-stop-daemon --start -v --pidfile ./tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1920x1080x16" + - "echo `xdpyinfo -display :99 | grep 'dimensions' | awk '{ print $2 }'`" + - travis_retry npm install + + # We need phantomjs 2.0 to get tests passing + - mkdir travis-phantomjs + - wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 + - tar -xvf $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -C $PWD/travis-phantomjs + - export PATH=$PWD/travis-phantomjs:$PATH + +before_script: + - sh script/ci_setup.sh $DB + +script: + - sh script/ci_runner.sh $TEST_SUITE $GROUP_SIZE $GROUP + +notifications: + email: false + slack: + secure: "a+I0uMgXgrDd3aitr2yhXrh7g/UOUTwoDVElunY7gYdrM+gpZ6RE1AP4/Q++hERBCs7rUBzmb//zxGTcc8Nw4nGqZOmPOMIsAoD49UupGLUzHbxzKlpwdBcwh77fq3rYwkjZjE/H1qiElPT7v6qyWMSdNGlj/bAB74eD7Zl3S5cMRvZ1whbSg2GA2v6ZqtXaKfrSFrPRzsIOBXs99OxWNWAsUGpEwTYac7wb6rdMJkBbzosp4gP99mGvQArEzo0nrIQgRH8W4Q6iLnrpX0g5uKccWl1u/G2bmH8L4F50ce4uuUE+TtHO/nfNFnb2KuDR4QyoccQQbGHXL/jaaAZXG/gzs5Hmru2Thaym43fSwxos80xmZs1vqB/rXE+Rg9qXcCKyyX31zjSI/iW4wS015fz8MKVX6qDg49epaw1ovn0AOYrvTd94GV6RX6eJ3/l+KJJHSKaaLP/713h11LWx/S27tiB40fboXQ68YzIQCuahRUEHUfhU3P10Wf9y2fdDsthtHHSrOJMQ3Ii/Jm3KQm6bE5RWORdHvc/sF2WLfLmJ627j9JhWYYi5mDKJ9AeMWtZNHreU0mM27OUgfhiW11ItKgpwQPEiiicrlYRrMmK+9hc9cym+8tRM+wEth1xhIkfgQFtngONKjv361Wt3JifxM79+bn0IyF72vAVNy8k=" + +addons: + firefox: "38.0esr" + postgresql: "9.3" + +# Disabling coverage reporting until CodeClimate supports merging results from multiple partial tests +# code_climate: +# repo_token: +# secure: "W/lyd8Ud18GRASuVShsIKa2MRHhxjh8WICMQ4WKr68qt0X0Tlp7Bclv4ReiEgiQeKsIoJJy5FfJfINdAT8A4sy2JbrLeISShcIU7Kqpfh6DSLNoRAuLz5P7EXMNFns1gBKCmrSzcB+9ksuTLyTCKkjUcj1NbJzGqpB4jSTecAdg=" \ No newline at end of file diff --git a/Gemfile.plugins b/Gemfile.plugins new file mode 100644 index 0000000000..ecbfb20364 --- /dev/null +++ b/Gemfile.plugins @@ -0,0 +1,7 @@ +# Used by travis to bundle this plugin with the OpenProject core. +# The tested plugin will be moved to the path `./plugins/this` +# whereas OpenProject will be checked out to `.`. + +gem 'openproject-global_roles', path: 'plugins/this' + +# If the plugin has any dependencies declare them here: \ No newline at end of file