exclude entity memberships from non member capability calculation

This commit is contained in:
ulferts
2023-09-06 11:18:40 +02:00
parent ca935e3f0f
commit 61a38adcf5
2 changed files with 19 additions and 0 deletions
@@ -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