diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/_page_specific_files.scss | 1 | ||||
-rw-r--r-- | app/assets/stylesheets/page_bundles/projects_usage_quotas.scss (renamed from app/assets/stylesheets/pages/storage_quota.scss) | 4 | ||||
-rw-r--r-- | app/controllers/admin/application_settings_controller.rb | 4 | ||||
-rw-r--r-- | app/models/bulk_imports/entity.rb | 2 | ||||
-rw-r--r-- | app/models/concerns/enums/package_metadata.rb | 4 | ||||
-rw-r--r-- | app/models/user_preference.rb | 2 | ||||
-rw-r--r-- | app/policies/group_policy.rb | 11 | ||||
-rw-r--r-- | app/services/bulk_imports/create_service.rb | 27 | ||||
-rw-r--r-- | app/services/ci/runners/create_runner_service.rb | 2 | ||||
-rw-r--r-- | app/views/layouts/nav/sidebar/_admin.html.haml | 1 | ||||
-rw-r--r-- | app/views/projects/usage_quotas/index.html.haml | 1 |
11 files changed, 44 insertions, 15 deletions
diff --git a/app/assets/stylesheets/_page_specific_files.scss b/app/assets/stylesheets/_page_specific_files.scss index c7693fb993d..cd626f449d9 100644 --- a/app/assets/stylesheets/_page_specific_files.scss +++ b/app/assets/stylesheets/_page_specific_files.scss @@ -14,4 +14,3 @@ @import './pages/projects'; @import './pages/registry'; @import './pages/settings'; -@import './pages/storage_quota'; diff --git a/app/assets/stylesheets/pages/storage_quota.scss b/app/assets/stylesheets/page_bundles/projects_usage_quotas.scss index 347bd1316c0..8f2cbc402c9 100644 --- a/app/assets/stylesheets/pages/storage_quota.scss +++ b/app/assets/stylesheets/page_bundles/projects_usage_quotas.scss @@ -1,3 +1,5 @@ +@import 'mixins_and_variables_and_functions'; + .storage-type-usage { &:first-child { @include gl-rounded-top-left-base; @@ -12,6 +14,6 @@ &:not(:last-child) { @include gl-border-r-2; @include gl-border-r-solid; - @include gl-border-white; + border-right-color: var(--white, $white); } } diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 0bbfeae6656..96d78034ad6 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -234,6 +234,9 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController params[:application_setting][:valid_runner_registrars]&.delete("") params[:application_setting][:restricted_visibility_levels]&.delete("") + params[:application_setting][:package_metadata_purl_types]&.delete("") + params[:application_setting][:package_metadata_purl_types]&.map!(&:to_i) + if params[:application_setting].key?(:required_instance_ci_template) if params[:application_setting][:required_instance_ci_template].empty? params[:application_setting][:required_instance_ci_template] = nil @@ -276,6 +279,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController :default_branch_name, disabled_oauth_sign_in_sources: [], import_sources: [], + package_metadata_purl_types: [], restricted_visibility_levels: [], repository_storages_weighted: {}, valid_runner_registrars: [] diff --git a/app/models/bulk_imports/entity.rb b/app/models/bulk_imports/entity.rb index d5d1d38784e..b3540917197 100644 --- a/app/models/bulk_imports/entity.rb +++ b/app/models/bulk_imports/entity.rb @@ -56,7 +56,7 @@ class BulkImports::Entity < ApplicationRecord validates :destination_namespace, presence: true, - if: :project + if: :project? validate :validate_parent_is_a_group, if: :parent validate :validate_imported_entity_type diff --git a/app/models/concerns/enums/package_metadata.rb b/app/models/concerns/enums/package_metadata.rb index abacee363c9..a866e2b995a 100644 --- a/app/models/concerns/enums/package_metadata.rb +++ b/app/models/concerns/enums/package_metadata.rb @@ -20,5 +20,9 @@ module Enums def self.purl_types PURL_TYPES end + + def self.purl_types_numerical + purl_types.invert + end end end diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index ecc64da2098..2519db825c0 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -24,6 +24,8 @@ class UserPreference < ApplicationRecord allow_blank: true validates :use_legacy_web_ide, allow_nil: false, inclusion: { in: [true, false] } + validates :pass_user_identities_to_ci_jwt, allow_nil: false, inclusion: { in: [true, false] } + validates :pinned_nav_items, json_schema: { filename: 'pinned_nav_items' } ignore_columns :experience_level, remove_with: '14.10', remove_after: '2021-03-22' diff --git a/app/policies/group_policy.rb b/app/policies/group_policy.rb index a285a8e361b..1f8e003b09a 100644 --- a/app/policies/group_policy.rb +++ b/app/policies/group_policy.rb @@ -191,6 +191,7 @@ class GroupPolicy < Namespaces::GroupProjectNamespaceSharedPolicy enable :destroy_package enable :admin_package enable :create_projects + enable :import_projects enable :admin_pipeline enable :admin_build enable :add_cluster @@ -261,14 +262,20 @@ class GroupPolicy < Namespaces::GroupProjectNamespaceSharedPolicy end.enable :change_share_with_group_lock rule { developer & developer_maintainer_access }.enable :create_projects - rule { create_projects_disabled }.prevent :create_projects + rule { create_projects_disabled }.policy do + prevent :create_projects + prevent :import_projects + end rule { owner | admin }.policy do enable :owner_access enable :read_statistics end - rule { maintainer & can?(:create_projects) }.enable :transfer_projects + rule { maintainer & can?(:create_projects) }.policy do + enable :transfer_projects + enable :import_projects + end rule { read_package_registry_deploy_token }.policy do enable :read_package diff --git a/app/services/bulk_imports/create_service.rb b/app/services/bulk_imports/create_service.rb index aec32209b19..4c9c59ac504 100644 --- a/app/services/bulk_imports/create_service.rb +++ b/app/services/bulk_imports/create_service.rb @@ -2,7 +2,7 @@ # Entry point of the BulkImport/Direct Transfer feature. # This service receives a Gitlab Instance connection params -# and a list of groups to be imported. +# and a list of groups or projects to be imported. # # Process topography: # @@ -15,16 +15,17 @@ # P1 (sync) # # - Create a BulkImport record -# - Create a BulkImport::Entity for each group to be imported -# - Enqueue a BulkImportWorker job (P2) to import the given groups (entities) +# - Create a BulkImport::Entity for each group or project (entities) to be imported +# - Enqueue a BulkImportWorker job (P2) to import the given entity # # Pn (async) # # - For each group to be imported (BulkImport::Entity.with_status(:created)) # - Import the group data # - Create entities for each subgroup of the imported group -# - Enqueue a BulkImports::CreateService job (Pn) to import the new entities (subgroups) -# +# - Create entities for each project of the imported group +# - Enqueue a BulkImportWorker job (Pn) to import the new entities + module BulkImports class CreateService ENTITY_TYPES_MAPPING = { @@ -84,7 +85,7 @@ module BulkImports Array.wrap(params).each do |entity_params| track_access_level(entity_params) - validate_destination_namespace(entity_params[:destination_namespace]) + validate_destination_namespace(entity_params) validate_destination_slug(entity_params[:destination_slug] || entity_params[:destination_name]) validate_destination_full_path(entity_params) @@ -137,10 +138,18 @@ module BulkImports credentials[:url].starts_with?(Settings.gitlab.base_url) end - def validate_destination_namespace(destination_namespace) - return if destination_namespace =~ Gitlab::Regex.bulk_import_destination_namespace_path_regex + def validate_destination_namespace(entity_params) + destination_namespace = entity_params[:destination_namespace] + source_type = entity_params[:source_type] - raise BulkImports::Error.destination_namespace_validation_failure + return if destination_namespace.blank? + + group = Group.find_by_full_path(destination_namespace) + if group.nil? || + (source_type == 'group_entity' && !current_user.can?(:create_subgroup, group)) || + (source_type == 'project_entity' && !current_user.can?(:import_projects, group)) + raise BulkImports::Error.destination_namespace_validation_failure(destination_namespace) + end end def validate_destination_slug(destination_slug) diff --git a/app/services/ci/runners/create_runner_service.rb b/app/services/ci/runners/create_runner_service.rb index fcb664500a9..ff4a33e431b 100644 --- a/app/services/ci/runners/create_runner_service.rb +++ b/app/services/ci/runners/create_runner_service.rb @@ -29,7 +29,7 @@ module Ci return ServiceResponse.success(payload: { runner: runner }) if runner.save - ServiceResponse.error(message: runner.errors.full_messages) + ServiceResponse.error(message: runner.errors.full_messages, reason: :save_error) end def normalize_params diff --git a/app/views/layouts/nav/sidebar/_admin.html.haml b/app/views/layouts/nav/sidebar/_admin.html.haml index 24b301fadce..2d61e403623 100644 --- a/app/views/layouts/nav/sidebar/_admin.html.haml +++ b/app/views/layouts/nav/sidebar/_admin.html.haml @@ -270,6 +270,7 @@ = link_to ci_cd_admin_application_settings_path, title: _('CI/CD') do %span = _('CI/CD') + = render_if_exists 'layouts/nav/ee/admin/security_and_compliance_sidebar' = nav_link(path: 'application_settings#reporting') do = link_to reporting_admin_application_settings_path, title: _('Reporting') do %span diff --git a/app/views/projects/usage_quotas/index.html.haml b/app/views/projects/usage_quotas/index.html.haml index bbe7eed6b14..5bfe6b650d1 100644 --- a/app/views/projects/usage_quotas/index.html.haml +++ b/app/views/projects/usage_quotas/index.html.haml @@ -1,4 +1,5 @@ - page_title s_("UsageQuota|Usage") +- add_page_specific_style 'page_bundles/projects_usage_quotas' = render_if_exists 'shared/ultimate_feature_removal_banner', project: @project |