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
18963ba6
Commit
18963ba6
authored
Dec 02, 2020
by
Sanad Liaquat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add end-to-end test for "Prevent forking outside of the group"
parent
1ba0026a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
109 additions
and
1 deletion
+109
-1
app/assets/javascripts/pages/projects/forks/new/components/fork_groups_list.vue
.../pages/projects/forks/new/components/fork_groups_list.vue
+1
-0
ee/app/views/groups/settings/_prevent_forking.html.haml
ee/app/views/groups/settings/_prevent_forking.html.haml
+1
-1
qa/qa/ee/page/group/settings/general.rb
qa/qa/ee/page/group/settings/general.rb
+16
-0
qa/qa/page/project/fork/new.rb
qa/qa/page/project/fork/new.rb
+8
-0
qa/qa/resource/sandbox.rb
qa/qa/resource/sandbox.rb
+13
-0
qa/qa/specs/features/ee/browser_ui/1_manage/group/prevent_forking_outside_group_spec.rb
...r_ui/1_manage/group/prevent_forking_outside_group_spec.rb
+70
-0
No files found.
app/assets/javascripts/pages/projects/forks/new/components/fork_groups_list.vue
View file @
18963ba6
...
...
@@ -85,6 +85,7 @@ export default {
v-model=
"filter"
:placeholder=
"$options.i18n.searchPlaceholder"
class=
"gl-align-self-center gl-ml-auto fork-filtered-search"
data-qa-selector=
"fork_groups_list_search_field"
/>
</
template
>
</gl-tabs>
...
...
ee/app/views/groups/settings/_prevent_forking.html.haml
View file @
18963ba6
...
...
@@ -2,7 +2,7 @@
.form-group.gl-mb-3
.form-check
=
f
.
check_box
:prevent_forking_outside_group
,
checked:
group
.
prevent_forking_outside_group?
,
class:
'form-check-input'
,
disabled:
!
can_change_prevent_forking?
(
current_user
,
group
)
=
f
.
check_box
:prevent_forking_outside_group
,
checked:
group
.
prevent_forking_outside_group?
,
class:
'form-check-input'
,
disabled:
!
can_change_prevent_forking?
(
current_user
,
group
)
,
data:
{
qa_selector:
'prevent_forking_outside_group_checkbox'
}
=
f
.
label
:prevent_forking_outside_group
,
class:
'form-check-label'
do
%span
.gl-display-block
=
s_
(
'GroupSettings|Prevent forking outside of the group'
)
%span
.text-muted
=
s_
(
'GroupSettings|This setting will prevent group members from forking projects outside of the group.'
)
qa/qa/ee/page/group/settings/general.rb
View file @
18963ba6
...
...
@@ -29,6 +29,10 @@ module QA
element
:membership_lock_checkbox
end
view
'ee/app/views/groups/settings/_prevent_forking.html.haml'
do
element
:prevent_forking_outside_group_checkbox
end
view
'ee/app/views/shared/_repository_size_limit_setting.html.haml'
do
element
:repository_size_limit_field
end
...
...
@@ -88,6 +92,18 @@ module QA
click_element
:save_permissions_changes_button
end
def
set_prevent_forking_outside_group_enabled
expand_content
:permission_lfs_2fa_content
check_element
:prevent_forking_outside_group_checkbox
click_element
:save_permissions_changes_button
end
def
set_prevent_forking_outside_group_disabled
expand_content
:permission_lfs_2fa_content
uncheck_element
:prevent_forking_outside_group_checkbox
click_element
:save_permissions_changes_button
end
def
set_repository_size_limit
(
limit
)
find_element
(
:repository_size_limit_field
).
set
limit
end
...
...
qa/qa/page/project/fork/new.rb
View file @
18963ba6
...
...
@@ -9,9 +9,17 @@ module QA
element
:fork_namespace_button
end
view
'app/assets/javascripts/pages/projects/forks/new/components/fork_groups_list.vue'
do
element
:fork_groups_list_search_field
end
def
choose_namespace
(
namespace
=
Runtime
::
Namespace
.
path
)
click_element
(
:fork_namespace_button
,
name:
namespace
)
end
def
search_for_group
(
group_name
)
find_element
(
:fork_groups_list_search_field
).
set
(
group_name
)
end
end
end
end
...
...
qa/qa/resource/sandbox.rb
View file @
18963ba6
...
...
@@ -76,6 +76,19 @@ module QA
visibility:
'public'
}
end
def
api_put_path
"/groups/
#{
id
}
"
end
def
update_group_setting
(
group_setting
:,
value
:)
put_body
=
{
"
#{
group_setting
}
"
:
value
}
response
=
put
Runtime
::
API
::
Request
.
new
(
api_client
,
api_put_path
).
url
,
put_body
unless
response
.
code
==
HTTP_STATUS_OK
raise
ResourceUpdateFailedError
,
"Could not update
#{
group_setting
}
to
#{
value
}
. Request returned (
#{
response
.
code
}
): `
#{
response
}
`."
end
end
end
end
end
qa/qa/specs/features/ee/browser_ui/1_manage/group/prevent_forking_outside_group_spec.rb
0 → 100644
View file @
18963ba6
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Manage'
do
describe
'prevent forking outside group'
do
let!
(
:group_for_fork
)
do
Resource
::
Sandbox
.
fabricate_via_api!
do
|
sandbox_group
|
sandbox_group
.
path
=
"group_for_fork_
#{
SecureRandom
.
hex
(
8
)
}
"
end
end
let
(
:project
)
do
Resource
::
Project
.
fabricate!
do
|
project
|
project
.
name
=
"project_to_fork"
project
.
initialize_with_readme
=
true
end
end
context
'when disabled'
do
before
do
set_prevent_forking_outside_group
(
'disabled'
)
end
it
'allows forking outside of group'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1070'
do
visit_project_and_search_group_for_fork
expect
(
page
).
to
have_text
(
group_for_fork
.
path
)
expect
(
page
).
to
have_text
(
'Select a namespace to fork the project'
)
end
end
context
'when enabled'
do
before
do
set_prevent_forking_outside_group
(
'enabled'
)
end
it
'does not allow forking outside of group'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1107'
do
visit_project_and_search_group_for_fork
expect
(
page
).
not_to
have_text
(
group_for_fork
.
path
)
expect
(
page
).
not_to
have_text
(
'Select a namespace to fork the project'
)
end
end
after
do
project
.
group
.
sandbox
.
update_group_setting
(
group_setting:
'prevent_forking_outside_group'
,
value:
false
)
project
.
remove_via_api!
group_for_fork
.
remove_via_api!
end
def
set_prevent_forking_outside_group
(
enabled_or_disabled
)
Flow
::
Login
.
sign_in
project
.
group
.
sandbox
.
visit!
Page
::
Group
::
Menu
.
perform
(
&
:click_group_general_settings_item
)
Page
::
Group
::
Settings
::
General
.
perform
do
|
general_setting
|
general_setting
.
send
(
"set_prevent_forking_outside_group_
#{
enabled_or_disabled
}
"
)
end
end
def
visit_project_and_search_group_for_fork
project
.
visit!
Page
::
Project
::
Show
.
perform
(
&
:fork_project
)
Page
::
Project
::
Fork
::
New
.
perform
do
|
fork_new
|
fork_new
.
search_for_group
(
group_for_fork
.
path
)
end
end
end
end
end
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