Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/groups')
-rw-r--r--app/services/groups/group_links/create_service.rb2
-rw-r--r--app/services/groups/group_links/destroy_service.rb2
-rw-r--r--app/services/groups/group_links/update_service.rb2
-rw-r--r--app/services/groups/import_export/import_service.rb18
4 files changed, 21 insertions, 3 deletions
diff --git a/app/services/groups/group_links/create_service.rb b/app/services/groups/group_links/create_service.rb
index 56ddf3ec0b4..52180c39972 100644
--- a/app/services/groups/group_links/create_service.rb
+++ b/app/services/groups/group_links/create_service.rb
@@ -2,7 +2,7 @@
module Groups
module GroupLinks
- class CreateService < Groups::BaseService
+ class CreateService < ::Groups::BaseService
include GroupLinkable
def initialize(group, shared_with_group, user, params)
diff --git a/app/services/groups/group_links/destroy_service.rb b/app/services/groups/group_links/destroy_service.rb
index 4d74b5f32e2..d1f16775ab3 100644
--- a/app/services/groups/group_links/destroy_service.rb
+++ b/app/services/groups/group_links/destroy_service.rb
@@ -2,7 +2,7 @@
module Groups
module GroupLinks
- class DestroyService < BaseService
+ class DestroyService < ::Groups::BaseService
def execute(one_or_more_links, skip_authorization: false)
unless skip_authorization || group && can?(current_user, :admin_group_member, group)
return error('Not Found', 404)
diff --git a/app/services/groups/group_links/update_service.rb b/app/services/groups/group_links/update_service.rb
index a1411de36d6..244ec2254a8 100644
--- a/app/services/groups/group_links/update_service.rb
+++ b/app/services/groups/group_links/update_service.rb
@@ -2,7 +2,7 @@
module Groups
module GroupLinks
- class UpdateService < BaseService
+ class UpdateService < ::Groups::BaseService
def initialize(group_link, user = nil)
super(group_link.shared_group, user)
diff --git a/app/services/groups/import_export/import_service.rb b/app/services/groups/import_export/import_service.rb
index 4092ded67bc..ac181245986 100644
--- a/app/services/groups/import_export/import_service.rb
+++ b/app/services/groups/import_export/import_service.rb
@@ -8,6 +8,7 @@ module Groups
def initialize(group:, user:)
@group = group
@current_user = user
+ @user_role = user_role
@shared = Gitlab::ImportExport::Shared.new(@group)
@logger = Gitlab::Import::Logger.build
end
@@ -31,6 +32,14 @@ module Groups
if valid_user_permissions? && import_file && restorers.all?(&:restore)
notify_success
+ Gitlab::Tracking.event(
+ self.class.name,
+ 'create',
+ label: 'import_access_level',
+ user: current_user,
+ extra: { user_role: user_role, import_type: 'import_group_from_file' }
+ )
+
group
else
notify_error!
@@ -43,6 +52,15 @@ module Groups
private
+ def user_role
+ # rubocop:disable CodeReuse/ActiveRecord, Style/MultilineTernaryOperator
+ access_level = group.parent ?
+ current_user&.group_members&.find_by(source_id: group.parent&.id)&.access_level :
+ Gitlab::Access::OWNER
+ Gitlab::Access.human_access(access_level)
+ # rubocop:enable CodeReuse/ActiveRecord, Style/MultilineTernaryOperator
+ end
+
def import_file
@import_file ||= Gitlab::ImportExport::FileImporter.import(
importable: group,