Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b4d5f8d0
Commit
b4d5f8d0
authored
Sep 04, 2020
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rollout security navbar to all created users
parent
4270e31c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
12 deletions
+2
-12
ee/app/helpers/ee/groups_helper.rb
ee/app/helpers/ee/groups_helper.rb
+0
-3
ee/app/helpers/ee/projects_helper.rb
ee/app/helpers/ee/projects_helper.rb
+0
-3
ee/spec/helpers/ee/groups_helper_spec.rb
ee/spec/helpers/ee/groups_helper_spec.rb
+1
-3
ee/spec/helpers/projects_helper_spec.rb
ee/spec/helpers/projects_helper_spec.rb
+1
-3
No files found.
ee/app/helpers/ee/groups_helper.rb
View file @
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
)
...
...
ee/app/helpers/ee/projects_helper.rb
View file @
b4d5f8d0
...
@@ -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
)
...
...
ee/spec/helpers/ee/groups_helper_spec.rb
View file @
b4d5f8d0
...
@@ -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
)
...
...
ee/spec/helpers/projects_helper_spec.rb
View file @
b4d5f8d0
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment