Permalink
Browse files

Merge tag 'v6.1.3' into stable/6

  • Loading branch information...
2 parents 7975e3b + be6a1fe commit 6dfd008b9dbcdfd5751968a1e4018d96c1e19801 @ulferts ulferts committed Dec 22, 2016
Showing with 76 additions and 61 deletions.
  1. +21 −21 Gemfile.lock
  2. +0 −4 app/models/query/results.rb
  3. +1 −2 app/models/work_package.rb
  4. +1 −1 lib/api/v3/work_packages/work_package_collection_representer.rb
  5. +1 −1 lib/open_project/version.rb
  6. +36 −16 spec/models/work_package/work_package_visibility_spec.rb
  7. +1 −1 vendored-plugins/openproject-auth_plugins/lib/open_project/auth_plugins/version.rb
  8. +1 −1 vendored-plugins/openproject-backlogs/lib/open_project/backlogs/version.rb
  9. +1 −1 vendored-plugins/openproject-costs/lib/open_project/costs/version.rb
  10. +1 −1 vendored-plugins/openproject-documents/lib/open_project/documents/version.rb
  11. +1 −1 vendored-plugins/openproject-github_integration/lib/open_project/github_integration/version.rb
  12. +1 −1 vendored-plugins/openproject-global_roles/lib/open_project/global_roles/version.rb
  13. +1 −1 vendored-plugins/openproject-local_avatars/lib/open_project/local_avatars/version.rb
  14. +1 −1 vendored-plugins/openproject-meeting/lib/open_project/meeting/version.rb
  15. +1 −1 vendored-plugins/openproject-my_project_page/lib/open_project/my_project_page/version.rb
  16. +1 −1 vendored-plugins/openproject-openid_connect/lib/open_project/openid_connect/version.rb
  17. +1 −1 vendored-plugins/openproject-pdf_export/lib/open_project/pdf_export/version.rb
  18. +1 −1 vendored-plugins/openproject-reporting/lib/open_project/reporting/version.rb
  19. +1 −1 vendored-plugins/openproject-themes-dark/lib/open_project/themes/dark/version.rb
  20. +1 −1 vendored-plugins/openproject-webhooks/lib/open_project/webhooks/version.rb
  21. +1 −1 vendored-plugins/openproject-xls_export/lib/open_project/xls_export/version.rb
  22. +1 −1 vendored-plugins/reporting_engine/lib/reporting_engine/version.rb
View
@@ -94,10 +94,10 @@ GIT
GIT
remote: https://github.com/opf/openproject-translations.git
- revision: 6ebd49ba35c610cd6face3fbe14c9f3af9c6e0c0
+ revision: 5ff2a6f1e733353bf558d72133f53187fccfc13c
branch: stable/6
specs:
- openproject-translations (6.1.2)
+ openproject-translations (6.1.3)
crowdin-api (~> 0.4.1)
mixlib-shellout (~> 2.1.0)
rails (~> 5.0.0)
@@ -132,67 +132,67 @@ GIT
PATH
remote: vendored-plugins/openproject-auth_plugins
specs:
- openproject-auth_plugins (6.1.2)
+ openproject-auth_plugins (6.1.3)
omniauth (~> 1.0)
rails (~> 5.0)
PATH
remote: vendored-plugins/openproject-backlogs
specs:
- openproject-backlogs (6.1.2)
+ openproject-backlogs (6.1.3)
acts_as_silent_list (~> 3.0.0)
- openproject-pdf_export (= 6.1.2)
+ openproject-pdf_export (= 6.1.3)
rails (~> 5.0.0)
PATH
remote: vendored-plugins/openproject-costs
specs:
- openproject-costs (6.1.2)
+ openproject-costs (6.1.3)
rails (~> 5.0.0)
PATH
remote: vendored-plugins/openproject-documents
specs:
- openproject-documents (6.1.2)
+ openproject-documents (6.1.3)
rails (~> 5.0.0)
PATH
remote: vendored-plugins/openproject-github_integration
specs:
- openproject-github_integration (6.1.2)
- openproject-webhooks (~> 6.1.2)
+ openproject-github_integration (6.1.3)
+ openproject-webhooks (~> 6.1.3)
rails (~> 5.0)
PATH
remote: vendored-plugins/openproject-global_roles
specs:
- openproject-global_roles (6.1.2)
+ openproject-global_roles (6.1.3)
rails (~> 5.0.0)
PATH
remote: vendored-plugins/openproject-local_avatars
specs:
- openproject-local_avatars (6.1.2)
+ openproject-local_avatars (6.1.3)
rails (~> 5.0)
rmagick (~> 2.15.4)
PATH
remote: vendored-plugins/openproject-meeting
specs:
- openproject-meeting (6.1.2)
+ openproject-meeting (6.1.3)
icalendar (~> 2.3.0)
rails (~> 5.0.0)
PATH
remote: vendored-plugins/openproject-my_project_page
specs:
- openproject-my_project_page (6.1.2)
+ openproject-my_project_page (6.1.3)
rails (~> 5.0.0)
PATH
remote: vendored-plugins/openproject-openid_connect
specs:
- openproject-openid_connect (6.1.2)
+ openproject-openid_connect (6.1.3)
lobby_boy (~> 0.1)
omniauth-openid_connect-providers (~> 0.1)
openproject-auth_plugins (~> 6.0)
@@ -201,42 +201,42 @@ PATH
PATH
remote: vendored-plugins/openproject-pdf_export
specs:
- openproject-pdf_export (6.1.2)
+ openproject-pdf_export (6.1.3)
prawn (~> 2.1.0)
rails (~> 5.0.0)
PATH
remote: vendored-plugins/openproject-reporting
specs:
- openproject-reporting (6.1.2)
+ openproject-reporting (6.1.3)
jquery-tablesorter (~> 1.22.3)
- openproject-costs (= 6.1.2)
+ openproject-costs (= 6.1.3)
rails (~> 5.0.0)
reporting_engine (>= 1.1.0)
PATH
remote: vendored-plugins/openproject-themes-dark
specs:
- openproject-themes-dark (6.1.2)
+ openproject-themes-dark (6.1.3)
rails (~> 5.0)
PATH
remote: vendored-plugins/openproject-webhooks
specs:
- openproject-webhooks (6.1.2)
+ openproject-webhooks (6.1.3)
rails (~> 5.0)
PATH
remote: vendored-plugins/openproject-xls_export
specs:
- openproject-xls_export (6.1.2)
+ openproject-xls_export (6.1.3)
rails (~> 5.0.0)
spreadsheet (~> 0.8.9)
PATH
remote: vendored-plugins/reporting_engine
specs:
- reporting_engine (6.1.2)
+ reporting_engine (6.1.3)
json
rails (~> 5.0.0)
@@ -87,12 +87,8 @@ def work_packages
includes = ([:status, :project] +
includes_for_columns(query.involved_columns) + (options[:include] || [])).uniq
- # A 'distinct' is added by the visible scope which is not necessary for
- # filtering the work packages and which might conflict with ordering in
- # mysql.
WorkPackage
.visible
- .distinct(false)
.where(::Query.merge_conditions(query.statement, options[:conditions]))
.includes(includes)
.joins((query.group_by_column ? query.group_by_column.join : nil))
@@ -69,8 +69,7 @@ class WorkPackage < ActiveRecord::Base
}
scope :visible, ->(*args) {
- joins(:project)
- .merge(Project.allowed_to(args.first || User.current, :view_work_packages))
+ where(project_id: Project.allowed_to(args.first || User.current, :view_work_packages))
}
scope :in_status, -> (*args) do
@@ -139,7 +139,7 @@ def add_eager_loading(scope, current_user)
end
def paged_models(models)
- models.page(@page).per_page(@per_page).pluck(:id).uniq
+ models.page(@page).per_page(@per_page).pluck(:id)
end
def full_work_packages(ids_in_order)
@@ -34,7 +34,7 @@ module OpenProject
module VERSION #:nodoc:
MAJOR = 6
MINOR = 1
- PATCH = 2
+ PATCH = 3
TINY = PATCH # Redmine compat
# Used by semver to define the special version (if any).
@@ -29,51 +29,71 @@
require 'spec_helper'
describe 'WorkPackage-Visibility', type: :model do
- let(:admin) { FactoryGirl.create(:admin) }
+ let(:admin) { FactoryGirl.create(:admin) }
let(:anonymous) { FactoryGirl.create(:anonymous) }
- let(:user) { FactoryGirl.create(:user) }
+ let(:user) { FactoryGirl.create(:user) }
let(:public_project) { FactoryGirl.create(:project, is_public: true) }
let(:private_project) { FactoryGirl.create(:project, is_public: false) }
let(:other_project) { FactoryGirl.create(:project, is_public: true) }
let(:view_work_packages) { FactoryGirl.create(:role, permissions: [:view_work_packages]) }
+ let(:view_work_packages_role2) { FactoryGirl.create(:role, permissions: [:view_work_packages]) }
describe 'of public projects' do
subject { FactoryGirl.create(:work_package, project: public_project) }
- it 'should be viewable by anonymous users, when the anonymous-role has the permission to view packages' do
+ it 'is viewable by anonymous, with the view_work_packages permissison' do
# it is not really clear, where these kind of "preconditions" belong to: This setting
# is a default in Redmine::DefaultData::Loader - but this not loaded in the tests: here we
# just make sure, that the workpackage is visible, when this permission is set
Role.anonymous.add_permission! :view_work_packages
- expect(WorkPackage.visible(anonymous)).to include subject
+ expect(WorkPackage.visible(anonymous)).to match_array [subject]
end
end
describe 'of private projects' do
subject { FactoryGirl.create(:work_package, project: private_project) }
- it 'should be visible for the admin, even if the project is private' do
- expect(WorkPackage.visible(admin)).to include subject
+ it 'is visible for the admin, even if the project is private' do
+ expect(WorkPackage.visible(admin)).to match_array [subject]
end
- it 'should not be visible for anonymous users, when the project is private' do
- expect(WorkPackage.visible(anonymous)).not_to include subject
+ it 'is not visible for anonymous users, when the project is private' do
+ expect(WorkPackage.visible(anonymous)).to match_array []
end
- it 'should be visible for members of the project, that are allowed to view workpackages' do
- member = FactoryGirl.create(:member, user: user, project: private_project, role_ids: [view_work_packages.id])
- expect(WorkPackage.visible(user)).to include subject
+ it 'is visible for members of the project, with the view_work_packages permissison' do
+ FactoryGirl.create(:member,
+ user: user,
+ project: private_project,
+ role_ids: [view_work_packages.id])
+
+ expect(WorkPackage.visible(user)).to match_array [subject]
+ end
+
+ it 'is only returned once for members with two roles having view_work_packages permission' do
+ subject
+
+ FactoryGirl.create(:member,
+ user: user,
+ project: private_project,
+ role_ids: [view_work_packages.id,
+ view_work_packages_role2.id])
+
+ expect(WorkPackage.visible(user).pluck(:id)).to match_array [subject.id]
end
- it 'should __not__ be visible for non-members of the project without the permission to view workpackages' do
- expect(WorkPackage.visible(user)).not_to include subject
+ it 'is not visible for non-members of the project without the view_work_packages permissison' do
+ expect(WorkPackage.visible(user)).to match_array []
end
- it 'should __not__ be visible for members of the project, without the right to view work_packages' do
+ it 'is not visible for members of the project, without the view_work_packages permissison' do
no_permission = FactoryGirl.create(:role, permissions: [:no_permission])
- member = FactoryGirl.create(:member, user: user, project: private_project, role_ids: [no_permission.id])
+ FactoryGirl.create(:member,
+ user: user,
+ project: private_project,
+ role_ids: [no_permission.id])
- expect(WorkPackage.visible(user)).not_to include subject
+ expect(WorkPackage.visible(user)).to match_array []
end
end
end
@@ -29,6 +29,6 @@
module OpenProject
module AuthPlugins
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
@@ -35,6 +35,6 @@
module OpenProject
module Backlogs
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
@@ -19,6 +19,6 @@
module OpenProject
module Costs
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
@@ -31,6 +31,6 @@
module OpenProject
module Documents
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
@@ -14,6 +14,6 @@
module OpenProject
module GithubIntegration
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
@@ -19,6 +19,6 @@
module OpenProject
module GlobalRoles
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
@@ -1,5 +1,5 @@
module OpenProject
module LocalAvatars
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
@@ -20,6 +20,6 @@
module OpenProject
module Meeting
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
@@ -20,6 +20,6 @@
module OpenProject
module MyProjectPage
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
@@ -1,5 +1,5 @@
module OpenProject
module OpenIDConnect
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
@@ -25,6 +25,6 @@
module OpenProject
module PdfExport
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
@@ -19,6 +19,6 @@
module OpenProject
module Reporting
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
@@ -1,7 +1,7 @@
module OpenProject
module Themes
module Dark
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
end
@@ -14,6 +14,6 @@
module OpenProject
module Webhooks
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
@@ -1,5 +1,5 @@
module OpenProject
module XlsExport
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end
end
@@ -18,5 +18,5 @@
#++
module ReportingEngine
- VERSION = "6.1.2"
+ VERSION = "6.1.3"
end

0 comments on commit 6dfd008

Please sign in to comment.