Commit 8821b8be authored by Małgorzata Ksionek's avatar Małgorzata Ksionek Committed by Jarka Košanová

Update group links service

parent e04e585c
...@@ -8,7 +8,10 @@ module EE ...@@ -8,7 +8,10 @@ module EE
override :execute override :execute
def execute(group) def execute(group)
super.tap { |link| log_audit_event(link) if link && link&.persisted? } result = super
log_audit_event(result[:link]) if result[:status] == :success
result
end end
private private
......
---
title: Remove the possibility to share a project with a group that a user is not a member
of
merge_request:
author:
type: security
...@@ -57,6 +57,7 @@ describe 'Project > Members > Invite group and members', :js do ...@@ -57,6 +57,7 @@ describe 'Project > Members > Invite group and members', :js do
before do before do
project.add_maintainer(maintainer) project.add_maintainer(maintainer)
group_to_share_with.add_developer(maintainer)
sign_in(maintainer) sign_in(maintainer)
end end
......
...@@ -36,6 +36,7 @@ describe Projects::GroupLinks::CreateService, '#execute' do ...@@ -36,6 +36,7 @@ describe Projects::GroupLinks::CreateService, '#execute' do
end end
def create_group_link(user, project, group, opts) def create_group_link(user, project, group, opts)
group.add_developer(user)
described_class.new(project, user, opts).execute(group) described_class.new(project, user, opts).execute(group)
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment