Commit e25d35f7 authored by Stan Hu's avatar Stan Hu

Merge branch 'aa-rollout-security-navbar-to-all-created-users' into 'master'

Rollout security navbar to all created users

See merge request gitlab-org/gitlab!41586
parents ecd844a7 b4d5f8d0
...@@ -74,11 +74,8 @@ module EE ...@@ -74,11 +74,8 @@ module EE
end end
def show_discover_group_security?(group) def show_discover_group_security?(group)
security_feature_available_at = DateTime.new(2019, 11, 1)
!!current_user && !!current_user &&
::Gitlab.com? && ::Gitlab.com? &&
current_user.created_at > security_feature_available_at &&
!@group.feature_available?(:security_dashboard) && !@group.feature_available?(:security_dashboard) &&
can?(current_user, :admin_group, @group) && can?(current_user, :admin_group, @group) &&
current_user.ab_feature_enabled?(:discover_security) current_user.ab_feature_enabled?(:discover_security)
......
...@@ -261,11 +261,8 @@ module EE ...@@ -261,11 +261,8 @@ module EE
end end
def show_discover_project_security?(project) def show_discover_project_security?(project)
security_feature_available_at = DateTime.new(2019, 11, 1)
!!current_user && !!current_user &&
::Gitlab.com? && ::Gitlab.com? &&
current_user.created_at > security_feature_available_at &&
!project.feature_available?(:security_dashboard) && !project.feature_available?(:security_dashboard) &&
can?(current_user, :admin_namespace, project.root_ancestor) && can?(current_user, :admin_namespace, project.root_ancestor) &&
current_user.ab_feature_enabled?(:discover_security) current_user.ab_feature_enabled?(:discover_security)
......
...@@ -133,7 +133,6 @@ RSpec.describe GroupsHelper do ...@@ -133,7 +133,6 @@ RSpec.describe GroupsHelper do
ab_feature_enabled?: [true, false], ab_feature_enabled?: [true, false],
gitlab_com?: [true, false], gitlab_com?: [true, false],
user?: [true, false], user?: [true, false],
created_at: [Time.mktime(2010, 1, 20), Time.mktime(2030, 1, 20)],
discover_security_feature_enabled?: [true, false], discover_security_feature_enabled?: [true, false],
security_dashboard_feature_available?: [true, false], security_dashboard_feature_available?: [true, false],
can_admin_group?: [true, false] can_admin_group?: [true, false]
...@@ -144,12 +143,11 @@ RSpec.describe GroupsHelper do ...@@ -144,12 +143,11 @@ RSpec.describe GroupsHelper do
allow(helper).to receive(:current_user) { user? ? owner : nil } allow(helper).to receive(:current_user) { user? ? owner : nil }
allow(::Gitlab).to receive(:com?) { gitlab_com? } allow(::Gitlab).to receive(:com?) { gitlab_com? }
allow(owner).to receive(:ab_feature_enabled?) { ab_feature_enabled? } allow(owner).to receive(:ab_feature_enabled?) { ab_feature_enabled? }
allow(owner).to receive(:created_at) { created_at }
allow(::Feature).to receive(:enabled?).with(:discover_security) { discover_security_feature_enabled? } allow(::Feature).to receive(:enabled?).with(:discover_security) { discover_security_feature_enabled? }
allow(group).to receive(:feature_available?) { security_dashboard_feature_available? } allow(group).to receive(:feature_available?) { security_dashboard_feature_available? }
allow(helper).to receive(:can?) { can_admin_group? } allow(helper).to receive(:can?) { can_admin_group? }
expected_value = user? && created_at > DateTime.new(2019, 11, 1) && gitlab_com? && expected_value = user? && gitlab_com? &&
ab_feature_enabled? && !security_dashboard_feature_available? && can_admin_group? ab_feature_enabled? && !security_dashboard_feature_available? && can_admin_group?
expect(helper.show_discover_group_security?(group)).to eq(expected_value) expect(helper.show_discover_group_security?(group)).to eq(expected_value)
......
...@@ -259,7 +259,6 @@ RSpec.describe ProjectsHelper do ...@@ -259,7 +259,6 @@ RSpec.describe ProjectsHelper do
ab_feature_enabled?: [true, false], ab_feature_enabled?: [true, false],
gitlab_com?: [true, false], gitlab_com?: [true, false],
user?: [true, false], user?: [true, false],
created_at: [Time.mktime(2010, 1, 20), Time.mktime(2030, 1, 20)],
security_dashboard_feature_available?: [true, false], security_dashboard_feature_available?: [true, false],
can_admin_namespace?: [true, false] can_admin_namespace?: [true, false]
) )
...@@ -269,11 +268,10 @@ RSpec.describe ProjectsHelper do ...@@ -269,11 +268,10 @@ RSpec.describe ProjectsHelper do
allow(::Gitlab).to receive(:com?) { gitlab_com? } allow(::Gitlab).to receive(:com?) { gitlab_com? }
allow(user).to receive(:ab_feature_enabled?) { ab_feature_enabled? } allow(user).to receive(:ab_feature_enabled?) { ab_feature_enabled? }
allow(helper).to receive(:current_user) { user? ? user : nil } allow(helper).to receive(:current_user) { user? ? user : nil }
allow(user).to receive(:created_at) { created_at }
allow(project).to receive(:feature_available?) { security_dashboard_feature_available? } allow(project).to receive(:feature_available?) { security_dashboard_feature_available? }
allow(helper).to receive(:can?) { can_admin_namespace? } allow(helper).to receive(:can?) { can_admin_namespace? }
expected_value = user? && created_at > DateTime.new(2019, 11, 1) && gitlab_com? && expected_value = user? && gitlab_com? &&
ab_feature_enabled? && !security_dashboard_feature_available? && can_admin_namespace? ab_feature_enabled? && !security_dashboard_feature_available? && can_admin_namespace?
expect(helper.show_discover_project_security?(project)).to eq(expected_value) expect(helper.show_discover_project_security?(project)).to eq(expected_value)
......
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