mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
exclude entity memberships from non member capability calculation
This commit is contained in:
@@ -112,6 +112,8 @@ module Capabilities::Scopes
|
||||
FROM members
|
||||
WHERE members.project_id = projects.id
|
||||
AND members.user_id = users.id
|
||||
AND members.entity_type IS NULL
|
||||
AND members.entity_id IS NULL
|
||||
LIMIT 1))
|
||||
LEFT OUTER JOIN enabled_modules
|
||||
ON enabled_modules.project_id = projects.id
|
||||
|
||||
@@ -503,6 +503,23 @@ RSpec.describe Capabilities::Scopes::Default do
|
||||
|
||||
include_examples 'is empty'
|
||||
end
|
||||
|
||||
context 'for a public project' do
|
||||
let(:non_member_permissions) { %i[view_members] }
|
||||
let(:members) { [work_package_member, non_member_role] }
|
||||
|
||||
before do
|
||||
project.update(public: true)
|
||||
end
|
||||
|
||||
include_examples 'consists of contract actions', with: 'the actions of the non member role`s permission' do
|
||||
let(:expected) do
|
||||
[
|
||||
['memberships/read', user.id, project.id]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user