Commit 6ba95dc2 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'use-licensed-feature-available' into 'master'

Use Namespace#licensed_feature_available? instead of Namespace#feature_available?

See merge request gitlab-org/gitlab!60117
parents f0009669 10885373
......@@ -2767,30 +2767,17 @@ Gitlab/FeatureAvailableUsage:
- 'app/helpers/events_helper.rb'
- 'app/helpers/labels_helper.rb'
- 'app/policies/project_policy.rb'
- 'app/views/groups/issues.html.haml'
- 'app/views/groups/merge_requests.html.haml'
- 'app/views/shared/boards/_switcher.html.haml'
- 'ee/app/controllers/concerns/description_diff_actions.rb'
- 'ee/app/controllers/concerns/ee/boards_actions.rb'
- 'ee/app/controllers/concerns/security_dashboards_permissions.rb'
- 'ee/app/controllers/ee/boards/lists_controller.rb'
- 'ee/app/controllers/ee/groups/application_controller.rb'
- 'ee/app/controllers/ee/groups/group_members_controller.rb'
- 'ee/app/controllers/ee/projects/autocomplete_sources_controller.rb'
- 'ee/app/controllers/ee/projects/issues_controller.rb'
- 'ee/app/controllers/ee/projects/security/configuration_controller.rb'
- 'ee/app/controllers/ee/projects/settings/ci_cd_controller.rb'
- 'ee/app/controllers/ee/projects/settings/operations_controller.rb'
- 'ee/app/controllers/ee/projects/settings/repository_controller.rb'
- 'ee/app/controllers/groups/analytics/application_controller.rb'
- 'ee/app/controllers/groups/audit_events_controller.rb'
- 'ee/app/controllers/groups/bulk_update_controller.rb'
- 'ee/app/controllers/groups/contribution_analytics_controller.rb'
- 'ee/app/controllers/groups/epics_controller.rb'
- 'ee/app/controllers/groups/hooks_controller.rb'
- 'ee/app/controllers/groups/issues_analytics_controller.rb'
- 'ee/app/controllers/groups/iterations_controller.rb'
- 'ee/app/controllers/projects/analytics/issues_analytics_controller.rb'
- 'ee/app/controllers/projects/audit_events_controller.rb'
- 'ee/app/controllers/projects/cluster_agents_controller.rb'
- 'ee/app/controllers/projects/iterations/inherited_controller.rb'
......@@ -2801,23 +2788,18 @@ Gitlab/FeatureAvailableUsage:
- 'ee/app/finders/clusters/agents_finder.rb'
- 'ee/app/finders/ee/alert_management/alerts_finder.rb'
- 'ee/app/finders/ee/alert_management/http_integrations_finder.rb'
- 'ee/app/finders/ee/group_projects_finder.rb'
- 'ee/app/graphql/ee/types/group_type.rb'
- 'ee/app/graphql/mutations/dast/profiles/create.rb'
- 'ee/app/graphql/mutations/dast/profiles/run.rb'
- 'ee/app/graphql/mutations/dast/profiles/update.rb'
- 'ee/app/graphql/mutations/instance_security_dashboard/remove_project.rb'
- 'ee/app/graphql/resolvers/boards/epic_boards_resolver.rb'
- 'ee/app/graphql/resolvers/clusters/agent_tokens_resolver.rb'
- 'ee/app/graphql/resolvers/epics_resolver.rb'
- 'ee/app/helpers/ee/analytics/navbar_helper.rb'
- 'ee/app/helpers/ee/application_helper.rb'
- 'ee/app/helpers/ee/boards_helper.rb'
- 'ee/app/helpers/ee/clusters_helper.rb'
- 'ee/app/helpers/ee/dashboard_helper.rb'
- 'ee/app/helpers/ee/form_helper.rb'
- 'ee/app/helpers/ee/graph_helper.rb'
- 'ee/app/helpers/ee/groups_helper.rb'
- 'ee/app/helpers/ee/issues_helper.rb'
- 'ee/app/helpers/ee/lock_helper.rb'
- 'ee/app/helpers/ee/operations_helper.rb'
......@@ -2826,7 +2808,6 @@ Gitlab/FeatureAvailableUsage:
- 'ee/app/helpers/ee/releases_helper.rb'
- 'ee/app/helpers/ee/search_helper.rb'
- 'ee/app/helpers/ee/tree_helper.rb'
- 'ee/app/helpers/groups/security_features_helper.rb'
- 'ee/app/models/approval_state.rb'
- 'ee/app/models/concerns/approvable.rb'
- 'ee/app/models/concerns/ee/project_security_scanners_information.rb'
......@@ -2849,15 +2830,12 @@ Gitlab/FeatureAvailableUsage:
- 'ee/app/models/ee/project_ci_cd_setting.rb'
- 'ee/app/models/namespace_statistics.rb'
- 'ee/app/models/project_security_setting.rb'
- 'ee/app/models/saml_provider.rb'
- 'ee/app/policies/compliance_management/framework_policy.rb'
- 'ee/app/policies/compliance_management/framework_policy.rb'
- 'ee/app/policies/ee/group_policy.rb'
- 'ee/app/policies/ee/namespace_policy.rb'
- 'ee/app/policies/ee/project_policy.rb'
- 'ee/app/policies/ee/protected_branch_policy.rb'
- 'ee/app/presenters/ee/label_presenter.rb'
- 'ee/app/presenters/epic_presenter.rb'
- 'ee/app/presenters/merge_request_approver_presenter.rb'
- 'ee/app/serializers/dashboard_operations_project_entity.rb'
- 'ee/app/serializers/ee/environment_entity.rb'
......@@ -2881,7 +2859,6 @@ Gitlab/FeatureAvailableUsage:
- 'ee/app/services/ee/boards/issues/list_service.rb'
- 'ee/app/services/ee/boards/lists/create_service.rb'
- 'ee/app/services/ee/boards/update_service.rb'
- 'ee/app/services/ee/groups/create_service.rb'
- 'ee/app/services/ee/ide/schemas_config_service.rb'
- 'ee/app/services/ee/issuable_base_service.rb'
- 'ee/app/services/ee/issue_links/create_service.rb'
......@@ -2896,9 +2873,6 @@ Gitlab/FeatureAvailableUsage:
- 'ee/app/services/ee/projects/create_service.rb'
- 'ee/app/services/ee/protected_branches/create_service.rb'
- 'ee/app/services/ee/releases/create_evidence_service.rb'
- 'ee/app/services/ee/search/group_service.rb'
- 'ee/app/services/iterations/cadences/create_service.rb'
- 'ee/app/services/iterations/cadences/update_service.rb'
- 'ee/app/services/iterations/create_service.rb'
- 'ee/app/services/iterations/update_service.rb'
- 'ee/app/services/merge_requests/sync_report_approver_approval_rules.rb'
......@@ -2907,16 +2881,6 @@ Gitlab/FeatureAvailableUsage:
- 'ee/app/services/quality_management/test_cases/create_service.rb'
- 'ee/app/services/requirements_management/process_test_reports_service.rb'
- 'ee/app/services/security/store_scans_service.rb'
- 'ee/app/views/groups/_templates_setting.html.haml'
- 'ee/app/views/groups/contribution_analytics/show.html.haml'
- 'ee/app/views/groups/ee/_settings_nav.html.haml'
- 'ee/app/views/groups/epics/index.html.haml'
- 'ee/app/views/groups/epics/show.html.haml'
- 'ee/app/views/groups/epics/show.html.haml'
- 'ee/app/views/groups/hooks/index.html.haml'
- 'ee/app/views/groups/roadmap/show.html.haml'
- 'ee/app/views/groups/settings/_allowed_email_domain.html.haml'
- 'ee/app/views/groups/settings/_ip_restriction.html.haml'
- 'ee/app/views/layouts/nav/_test_cases_link.html.haml'
- 'ee/app/views/layouts/nav/sidebar/_project_iterations_link.html.haml'
- 'ee/app/views/projects/_merge_request_approvals_settings.html.haml'
......@@ -2950,7 +2914,6 @@ Gitlab/FeatureAvailableUsage:
- 'ee/app/views/shared/issuable/_board_create_list_dropdown.html.haml'
- 'ee/app/views/shared/issuable/_board_create_list_dropdown.html.haml'
- 'ee/app/views/shared/issuable/_group_bulk_update_sidebar.html.haml'
- 'ee/app/views/shared/issuable/_iteration_select.html.haml'
- 'ee/app/views/shared/issuable/form/_default_templates.html.haml'
- 'ee/app/views/shared/labels/_create_label_help_text.html.haml'
- 'ee/app/views/shared/promotions/_promote_mr_features.html.haml'
......@@ -2964,14 +2927,10 @@ Gitlab/FeatureAvailableUsage:
- 'ee/app/workers/analytics/code_review_metrics_worker.rb'
- 'ee/app/workers/group_saml_group_sync_worker.rb'
- 'ee/lib/api/external_approval_rules.rb'
- 'ee/lib/api/helpers/epics_helpers.rb'
- 'ee/lib/api/ldap_group_links.rb'
- 'ee/lib/ee/api/entities/approval_state.rb'
- 'ee/lib/ee/api/entities/board.rb'
- 'ee/lib/ee/api/entities/group.rb'
- 'ee/lib/ee/api/entities/issue.rb'
- 'ee/lib/ee/api/entities/project.rb'
- 'ee/lib/ee/api/groups.rb'
- 'ee/lib/ee/api/helpers.rb'
- 'ee/lib/ee/api/internal/kubernetes.rb'
- 'ee/lib/ee/api/job_artifacts.rb'
......@@ -2981,14 +2940,11 @@ Gitlab/FeatureAvailableUsage:
- 'ee/lib/ee/gitlab/gon_helper.rb'
- 'ee/lib/ee/gitlab/tree_summary.rb'
- 'ee/lib/gitlab/alert_management.rb'
- 'ee/lib/gitlab/auth/group_saml/group_lookup.rb'
- 'ee/lib/gitlab/ci/pipeline/chain/config/content/compliance.rb'
- 'ee/lib/gitlab/code_owners.rb'
- 'ee/lib/gitlab/import_export/group/group_and_descendants_repo_restorer.rb'
- 'ee/lib/gitlab/incident_management.rb'
- 'ee/lib/gitlab/path_locks_finder.rb'
- 'ee/lib/incident_management/incident_sla.rb'
- 'ee/spec/models/ee/namespace_spec.rb'
- 'ee/spec/models/instance_security_dashboard_spec.rb'
- 'ee/spec/models/license_spec.rb'
- 'ee/spec/models/project_spec.rb'
......
- @can_bulk_update = can?(current_user, :admin_issue, @group) && @group.feature_available?(:group_bulk_edit)
- @can_bulk_update = can?(current_user, :admin_issue, @group) && @group.licensed_feature_available?(:group_bulk_edit)
- page_title _("Issues")
- add_page_specific_style 'page_bundles/issues_list'
......
- @can_bulk_update = can?(current_user, :admin_merge_request, @group) && @group.feature_available?(:group_bulk_edit)
- @can_bulk_update = can?(current_user, :admin_merge_request, @group) && @group.licensed_feature_available?(:group_bulk_edit)
- page_title _("Merge requests")
......
......@@ -20,7 +20,7 @@ Since the implementation of
[GitLab CE features to work with unlicensed EE instance](https://gitlab.com/gitlab-org/gitlab/-/issues/2500)
GitLab Enterprise Edition should work like GitLab Community Edition
when no license is active. So EE features always should be guarded by
`project.feature_available?` or `group.feature_available?` (or
`project.feature_available?` or `group.licensed_feature_available?` (or
`License.feature_available?` if it is a system-wide feature).
Frontend features should be guarded by pushing a flag from the backend by [using `push_licensed_feature`](licensed_feature_availability.md#restricting-frontend-features), and checked using `this.glFeatures.someFeature` in the frontend.
......
......@@ -6,7 +6,7 @@ module EE
extend ActiveSupport::Concern
def check_group_feature_available!(feature)
render_404 unless group.feature_available?(feature)
render_404 unless group.licensed_feature_available?(feature)
end
def method_missing(method_sym, *arguments, &block)
......
......@@ -57,7 +57,7 @@ module EE
override :membershipable_members
def membershipable_members
return super unless group.feature_available?(:minimal_access_role)
return super unless group.licensed_feature_available?(:minimal_access_role)
group.all_group_members
end
......
......@@ -11,7 +11,7 @@ module EE
end
def epics
return render_404 unless project.group.feature_available?(:epics)
return render_404 unless project.group.licensed_feature_available?(:epics)
render json: autocomplete_service.epics
end
......
......@@ -17,7 +17,7 @@ class Groups::Analytics::ApplicationController < ApplicationController
end
def check_feature_availability!(feature)
return render_403 unless @group && @group.feature_available?(feature)
return render_403 unless @group && @group.licensed_feature_available?(feature)
end
def load_group
......
......@@ -25,7 +25,7 @@ class Groups::AuditEventsController < Groups::ApplicationController
def check_audit_events_available!
render_404 unless can?(current_user, :read_group_audit_events, group) &&
group.feature_available?(:audit_events)
group.licensed_feature_available?(:audit_events)
end
def events
......
......@@ -8,6 +8,6 @@ class Groups::BulkUpdateController < Groups::ApplicationController
private
def verify_group_bulk_edit_enabled!
render_404 unless group.feature_available?(:group_bulk_edit)
render_404 unless group.licensed_feature_available?(:group_bulk_edit)
end
end
......@@ -52,7 +52,7 @@ class Groups::ContributionAnalyticsController < Groups::ApplicationController
end
def group_has_access_to_feature?
@group.feature_available?(:contribution_analytics)
@group.licensed_feature_available?(:contribution_analytics)
end
def user_has_access_to_feature?
......
......@@ -127,6 +127,6 @@ class Groups::EpicsController < Groups::ApplicationController
end
def verify_group_bulk_edit_enabled!
render_404 unless group.feature_available?(:group_bulk_edit)
render_404 unless group.licensed_feature_available?(:group_bulk_edit)
end
end
......@@ -81,6 +81,6 @@ class Groups::HooksController < Groups::ApplicationController
end
def check_group_webhooks_available!
render_404 unless @group.feature_available?(:group_webhooks) || LicenseHelper.show_promotions?(current_user)
render_404 unless @group.licensed_feature_available?(:group_webhooks) || LicenseHelper.show_promotions?(current_user)
end
end
......@@ -31,7 +31,7 @@ class Groups::IssuesAnalyticsController < Groups::ApplicationController
private
def authorize_read_issue_analytics!
render_404 unless group.feature_available?(:issues_analytics)
render_404 unless group.licensed_feature_available?(:issues_analytics)
end
def authorize_read_group!
......
......@@ -18,7 +18,7 @@ class Groups::IterationsController < Groups::ApplicationController
private
def check_iterations_available!
render_404 unless group.feature_available?(:iterations)
render_404 unless group.licensed_feature_available?(:iterations)
end
def authorize_create_iteration!
......
......@@ -18,7 +18,7 @@ module EE
end
def by_security_reports_presence(collection)
if params[:with_security_reports] && group.feature_available?(:security_dashboard)
if params[:with_security_reports] && group.licensed_feature_available?(:security_dashboard)
collection.with_security_reports
else
collection
......
......@@ -17,7 +17,7 @@ module Resolvers
def resolve(id: nil)
return unless Feature.enabled?(:epic_boards, group)
return unless group.feature_available?(:epics)
return unless group.licensed_feature_available?(:epics)
authorize!
......
......@@ -92,7 +92,7 @@ module Resolvers
end
def epic_feature_enabled?
group.feature_available?(:epics)
group.licensed_feature_available?(:epics)
end
def transform_args(args)
......
......@@ -128,7 +128,7 @@ module EE
end
def group_ci_cd_analytics_navbar_link(group, current_user)
return unless group.feature_available?(:group_ci_cd_analytics)
return unless group.licensed_feature_available?(:group_ci_cd_analytics)
return unless group_sidebar_link?(:group_ci_cd_analytics)
navbar_sub_item(
......@@ -139,7 +139,7 @@ module EE
end
def group_repository_analytics_navbar_link(group, current_user)
return unless group.feature_available?(:group_coverage_reports)
return unless group.licensed_feature_available?(:group_coverage_reports)
return unless group_sidebar_link?(:repository_analytics)
navbar_sub_item(
......
......@@ -72,7 +72,7 @@ module EE
override :remove_group_message
def remove_group_message(group)
return super unless group.feature_available?(:adjourned_deletion_for_projects_and_groups)
return super unless group.licensed_feature_available?(:adjourned_deletion_for_projects_and_groups)
date = permanent_deletion_date(Time.now.utc)
......@@ -91,7 +91,7 @@ module EE
def show_discover_group_security?(group)
!!current_user &&
::Gitlab.com? &&
!@group.feature_available?(:security_dashboard) &&
!@group.licensed_feature_available?(:security_dashboard) &&
can?(current_user, :admin_group, @group)
end
......@@ -124,7 +124,7 @@ module EE
end
def show_delayed_project_removal_setting?(group)
group.feature_available?(:adjourned_deletion_for_projects_and_groups)
group.licensed_feature_available?(:adjourned_deletion_for_projects_and_groups)
end
private
......@@ -146,7 +146,7 @@ module EE
links << :epics
end
if @group.feature_available?(:issues_analytics)
if @group.licensed_feature_available?(:issues_analytics)
links << :analytics
end
......@@ -154,15 +154,15 @@ module EE
links << :group_insights
end
if @group.feature_available?(:productivity_analytics) && can?(current_user, :view_productivity_analytics, @group)
if @group.licensed_feature_available?(:productivity_analytics) && can?(current_user, :view_productivity_analytics, @group)
links << :productivity_analytics
end
if ::Feature.enabled?(:group_iterations, @group, default_enabled: true) && @group.feature_available?(:iterations) && can?(current_user, :read_iteration, @group)
if ::Feature.enabled?(:group_iterations, @group, default_enabled: true) && @group.licensed_feature_available?(:iterations) && can?(current_user, :read_iteration, @group)
links << :iterations
end
if ::Feature.enabled?(:group_ci_cd_analytics_page, @group, default_enabled: true) && @group.feature_available?(:group_ci_cd_analytics) && can?(current_user, :view_group_ci_cd_analytics, @group)
if ::Feature.enabled?(:group_ci_cd_analytics_page, @group, default_enabled: true) && @group.licensed_feature_available?(:group_ci_cd_analytics) && can?(current_user, :view_group_ci_cd_analytics, @group)
links << :group_ci_cd_analytics
end
......
......@@ -2,11 +2,11 @@
module Groups::SecurityFeaturesHelper
def group_level_security_dashboard_available?(group)
group.feature_available?(:security_dashboard)
group.licensed_feature_available?(:security_dashboard)
end
def group_level_compliance_dashboard_available?(group)
group.feature_available?(:group_level_compliance_dashboard) &&
group.licensed_feature_available?(:group_level_compliance_dashboard) &&
can?(current_user, :read_group_compliance_dashboard, group)
end
......@@ -16,7 +16,7 @@ module Groups::SecurityFeaturesHelper
def group_level_credentials_inventory_available?(group)
can?(current_user, :read_group_credentials_inventory, group) &&
group.feature_available?(:credentials_inventory) &&
group.licensed_feature_available?(:credentials_inventory) &&
group.enforced_group_managed_accounts?
end
......@@ -33,7 +33,7 @@ module Groups::SecurityFeaturesHelper
end
def group_level_audit_events_available?(group)
group.feature_available?(:audit_events) &&
group.licensed_feature_available?(:audit_events) &&
can?(current_user, :read_group_audit_events, group)
end
......
......@@ -34,7 +34,7 @@ module EE
end
def group_has_domain_limitations?
group.feature_available?(:group_allowed_email_domains) && group_allowed_email_domains.any?
group.licensed_feature_available?(:group_allowed_email_domains) && group_allowed_email_domains.any?
end
def group_domain_limitations
......
......@@ -33,7 +33,7 @@ class SamlProvider < ApplicationRecord
end
def enforced_sso?
enabled? && super && group.feature_available?(:group_saml)
enabled? && super && group.licensed_feature_available?(:group_saml)
end
def git_check_enforced?
......
......@@ -56,7 +56,7 @@ module EE
with_scope :subject
condition(:group_push_rules_enabled) do
@subject.group && @subject.group.feature_available?(:push_rules)
@subject.group && @subject.group.licensed_feature_available?(:push_rules)
end
with_scope :subject
......
......@@ -68,7 +68,7 @@ class EpicPresenter < Gitlab::View::Presenter::Delegated
todo_path: group_todos_path(group),
lock_version: epic.lock_version,
state: epic.state,
scoped_labels: group.feature_available?(:scoped_labels)
scoped_labels: group.licensed_feature_available?(:scoped_labels)
}
end
......
......@@ -44,7 +44,7 @@ module EE
end
def create_push_rule_for_group
return unless group.feature_available?(:push_rules)
return unless group.licensed_feature_available?(:push_rules)
push_rule = group.predefined_push_rule
return unless push_rule
......
......@@ -38,7 +38,7 @@ module EE
override :allowed_scopes
def allowed_scopes
return super unless group.feature_available?(:epics)
return super unless group.licensed_feature_available?(:epics)
strong_memoize(:ee_group_allowed_scopes) do
super + %w(epics)
......
......@@ -34,7 +34,7 @@ module Iterations
end
def can_create_single_or_multiple_iteration_cadences?
group.feature_available?(:iterations) && (group.iterations_cadences.empty? || group.multiple_iteration_cadences_available?)
group.licensed_feature_available?(:iterations) && (group.iterations_cadences.empty? || group.multiple_iteration_cadences_available?)
end
end
end
......
......@@ -29,7 +29,7 @@ module Iterations
group = iteration_cadence.group
group.iteration_cadences_feature_flag_enabled? &&
group.feature_available?(:iterations) &&
group.licensed_feature_available?(:iterations) &&
can?(current_user, :admin_iteration_cadence, iteration_cadence)
end
end
......
- return unless @group.feature_available?(:custom_file_templates_for_namespace)
- return unless @group.licensed_feature_available?(:custom_file_templates_for_namespace)
%section.settings.no-animate#js-templates{ class: ('expanded' if expanded), data: { qa_selector: 'file_template_repositories' } }
.settings-header
......
- page_title s_('Contribution Analytics')
- if @group.feature_available?(:contribution_analytics)
- if @group.licensed_feature_available?(:contribution_analytics)
.mb-3
%h3
= s_('Contribution Analytics')
......
......@@ -18,7 +18,7 @@
%span
= s_('GroupSAML|SAML Group Links')
- if @group.feature_available?(:group_webhooks) || show_promotions?
- if @group.licensed_feature_available?(:group_webhooks) || show_promotions?
= nav_link(path: 'hooks#index') do
= link_to group_hooks_path(@group), title: 'Webhooks' do
%span
......
- @can_bulk_update = can?(current_user, :admin_epic, @group) && @group.feature_available?(:group_bulk_edit)
- @can_bulk_update = can?(current_user, :admin_epic, @group) && @group.licensed_feature_available?(:group_bulk_edit)
- page_title _("Epics")
......
......@@ -3,8 +3,8 @@
- @content_class = 'limit-container-width' unless fluid_layout
- epic_reference = @epic.to_reference
- sub_epics_feature_available = @group.feature_available?(:subepics)
- issuable_health_status_feature_available = @group.feature_available?(:issuable_health_status)
- sub_epics_feature_available = @group.licensed_feature_available?(:subepics)
- issuable_health_status_feature_available = @group.licensed_feature_available?(:issuable_health_status)
- allow_sub_epics = sub_epics_feature_available ? 'true' : 'false'
- allow_issuable_health_status = issuable_health_status_feature_available ? 'true' : 'false'
......
- page_title @hook.pluralized_name
- if @group.feature_available?(:group_webhooks)
- if @group.licensed_feature_available?(:group_webhooks)
.row.gl-mt-3
.col-lg-3
= render 'shared/web_hooks/title_and_docs', hook: @hook
......
......@@ -5,7 +5,7 @@
- if Feature.enabled?(:group_iterations, @group, default_enabled: true)
.js-iteration{ data: { full_path: @group.full_path,
can_edit: can?(current_user, :admin_iteration, @group).to_s,
has_scoped_labels_feature: @group.feature_available?(:scoped_labels).to_s,
has_scoped_labels_feature: @group.licensed_feature_available?(:scoped_labels).to_s,
iteration_id: params[:id],
labels_fetch_path: group_labels_path(@group, format: :json, include_ancestor_groups: true),
preview_markdown_path: preview_markdown_path(@group),
......
......@@ -5,7 +5,7 @@
- @content_wrapper_class = "group-epics-roadmap-wrapper"
- @content_class = "group-epics-roadmap"
- breadcrumb_title _("Epics Roadmap")
- sub_epics_feature_available = @group.feature_available?(:subepics)
- sub_epics_feature_available = @group.licensed_feature_available?(:subepics)
- allow_sub_epics = sub_epics_feature_available ? 'true' : 'false'
- page_title _("Epics Roadmap")
- add_page_specific_style 'page_bundles/roadmap'
......
- return if !group.feature_available?(:group_allowed_email_domains) || group.parent_id.present?
- return if !group.licensed_feature_available?(:group_allowed_email_domains) || group.parent_id.present?
- hidden_input_id = 'group_allowed_email_domains_list'
- label_id = "#{hidden_input_id}_label"
......
- return if !group.feature_available?(:group_ip_restriction) || group.parent_id.present?
- return if !group.licensed_feature_available?(:group_ip_restriction) || group.parent_id.present?
- hidden_input_id = 'group_ip_restriction_ranges'
- label_id = "#{hidden_input_id}_label"
......
- if Feature.enabled?(:group_iterations, @project.group, default_enabled: true) && @project.group.feature_available?(:iterations)
- if Feature.enabled?(:group_iterations, @project.group, default_enabled: true) && @project.group.licensed_feature_available?(:iterations)
.js-iteration-select{ data: { can_edit: can_edit, group_path: group_path, project_path: project_path, issue_iid: issue_iid } }
......@@ -4,11 +4,11 @@ module API
module Helpers
module EpicsHelpers
def authorize_epics_feature!
forbidden! unless user_group.feature_available?(:epics)
forbidden! unless user_group.licensed_feature_available?(:epics)
end
def authorize_subepics_feature!
forbidden! unless user_group.feature_available?(:subepics)
forbidden! unless user_group.licensed_feature_available?(:subepics)
end
def authorize_can_read!
......
......@@ -40,7 +40,7 @@ module API
post ":id/ldap_group_links" do
group = find_group(params[:id])
authorize! :admin_group, group
break not_found! if params[:filter] && !group.feature_available?(:ldap_group_sync_filter)
break not_found! if params[:filter] && !group.licensed_feature_available?(:ldap_group_sync_filter)
ldap_group_link = group.ldap_group_links.new(declared_params(include_missing: false))
......@@ -107,7 +107,7 @@ module API
delete ":id/ldap_group_links" do
group = find_group(params[:id])
authorize! :admin_group, group
break not_found! if params[:filter] && !group.feature_available?(:ldap_group_sync_filter)
break not_found! if params[:filter] && !group.licensed_feature_available?(:ldap_group_sync_filter)
ldap_group_link = group.ldap_group_links.find_by(declared_params(include_missing: false))
......
......@@ -15,11 +15,11 @@ module EE
expose :checked_file_template_project_id,
as: :file_template_project_id,
if: ->(group, options) {
group.feature_available?(:custom_file_templates_for_namespace) &&
group.licensed_feature_available?(:custom_file_templates_for_namespace) &&
Ability.allowed?(options[:current_user], :read_project, group.checked_file_template_project)
}
expose :marked_for_deletion_on, if: ->(group, _) { group.feature_available?(:adjourned_deletion_for_projects_and_groups) }
expose :marked_for_deletion_on, if: ->(group, _) { group.licensed_feature_available?(:adjourned_deletion_for_projects_and_groups) }
end
end
end
......
......@@ -41,7 +41,7 @@ module EE
override :update_group
def update_group(group)
params.delete(:file_template_project_id) unless
group.feature_available?(:custom_file_templates_for_namespace)
group.licensed_feature_available?(:custom_file_templates_for_namespace)
params.delete(:prevent_forking_outside_group) unless
can?(current_user, :change_prevent_group_forking, group)
......@@ -55,7 +55,7 @@ module EE
end
def check_audit_events_available!(group)
forbidden! unless group.feature_available?(:audit_events)
forbidden! unless group.licensed_feature_available?(:audit_events)
end
def audit_log_finder_params
......@@ -146,7 +146,7 @@ module EE
desc 'Restore a group.'
post ':id/restore' do
authorize! :admin_group, user_group
break not_found! unless user_group.feature_available?(:adjourned_deletion_for_projects_and_groups)
break not_found! unless user_group.licensed_feature_available?(:adjourned_deletion_for_projects_and_groups)
result = ::Groups::RestoreService.new(user_group, current_user).execute
user_group.preload_shared_group_links
......
......@@ -21,7 +21,7 @@ module Gitlab
end
def group_saml_enabled?
saml_provider&.enabled? && group.feature_available?(:group_saml)
saml_provider&.enabled? && group.licensed_feature_available?(:group_saml)
end
def token_discoverable?
......
......@@ -26,7 +26,7 @@ module Gitlab
# If, at some point, we add more repositories to groups, we should
# move this check inside the loop, along with the other checks
# for the new repository type.
return true unless group.feature_available?(:group_wikis)
return true unless group.licensed_feature_available?(:group_wikis)
return true if group_mapping.empty?
group.self_and_descendants.find_each.all? do |subgroup|
......
......@@ -253,7 +253,7 @@ RSpec.describe GroupsHelper do
it 'returns the expected value' do
allow(helper).to receive(:current_user) { user? ? owner : nil }
allow(::Gitlab).to receive(:com?) { gitlab_com? }
allow(group).to receive(:feature_available?) { security_dashboard_feature_available? }
allow(group).to receive(:licensed_feature_available?) { security_dashboard_feature_available? }
allow(helper).to receive(:can?) { can_admin_group? }
expected_value = user? && gitlab_com? && !security_dashboard_feature_available? && can_admin_group?
......
......@@ -378,7 +378,7 @@ RSpec.describe Namespace do
it 'only checks the plan once' do
expect(group).to receive(:load_feature_available).once.and_call_original
2.times { group.feature_available?(:push_rules) }
2.times { group.licensed_feature_available?(:push_rules) }
end
context 'when checking namespace plan' do
......@@ -403,7 +403,7 @@ RSpec.describe Namespace do
let(:child_group) { create :group, parent: group }
it 'child group has feature available' do
expect(child_group.feature_available?(feature)).to be_truthy
expect(child_group.licensed_feature_available?(feature)).to be_truthy
end
end
end
......@@ -420,7 +420,7 @@ RSpec.describe Namespace do
end
describe '#feature_available?' do
subject { group.feature_available?(feature) }
subject { group.licensed_feature_available?(feature) }
it_behaves_like 'feature available'
end
......
......@@ -101,8 +101,8 @@ RSpec.describe 'groups/edit.html.haml' do
context 'feature is enabled' do
before do
allow(group).to receive(:feature_available?).and_return(false)
allow(group).to receive(:feature_available?).with(:group_allowed_email_domains).and_return(true)
allow(group).to receive(:licensed_feature_available?).and_return(false)
allow(group).to receive(:licensed_feature_available?).with(:group_allowed_email_domains).and_return(true)
end
context 'top-level group' do
......
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