Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Use built-in mechanism to register module and permission

Oliver Günther9aca6a8a8253
diff --git a/lib/open_project/gitlab_integration/engine.rb b/lib/open_project/gitlab_integration/engine.rb
index 78ac422fe7e..2c47bb262ff 100644
--- a/lib/open_project/gitlab_integration/engine.rb
+++ b/lib/open_project/gitlab_integration/engine.rb
@@ -42,7 +42,11 @@ module OpenProject::GitlabIntegration
register 'openproject-gitlab_integration',
:author_url => 'https://github.com/btey/openproject',
- bundled: true
+ bundled: true do
+ project_module(:gitlab, dependencies: :work_package_tracking) do
+ permission(:show_gitlab_content, {})
+ end
+ end
patches %w[WorkPackage]
@@ -65,14 +69,6 @@ module OpenProject::GitlabIntegration
&NotificationHandlers.method(:pipeline_hook))
end
- initializer 'gitlab.permissions' do
- OpenProject::AccessControl.map do |ac_map|
- ac_map.project_module(:gitlab, dependencies: :work_package_tracking) do |pm_map|
- pm_map.permission(:show_gitlab_content, {})
- end
- end
- end
-
extend_api_response(:v3, :work_packages, :work_package,
&::OpenProject::GitlabIntegration::Patches::API::WorkPackageRepresenter.extension)