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
aa65354d
Commit
aa65354d
authored
Dec 30, 2021
by
Pedro Pombeiro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make admin/register runners only available to owners
parent
9edc206e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
16 deletions
+32
-16
app/policies/group_policy.rb
app/policies/group_policy.rb
+2
-2
app/views/projects/runners/_group_runners.html.haml
app/views/projects/runners/_group_runners.html.haml
+2
-2
locale/gitlab.pot
locale/gitlab.pot
+4
-4
spec/features/runners_spec.rb
spec/features/runners_spec.rb
+21
-4
spec/policies/group_policy_spec.rb
spec/policies/group_policy_spec.rb
+1
-3
spec/support/shared_contexts/policies/group_policy_shared_context.rb
...t/shared_contexts/policies/group_policy_shared_context.rb
+2
-1
No files found.
app/policies/group_policy.rb
View file @
aa65354d
...
@@ -162,8 +162,6 @@ class GroupPolicy < Namespaces::GroupProjectNamespaceSharedPolicy
...
@@ -162,8 +162,6 @@ class GroupPolicy < Namespaces::GroupProjectNamespaceSharedPolicy
enable
:destroy_package
enable
:destroy_package
enable
:create_projects
enable
:create_projects
enable
:admin_pipeline
enable
:admin_pipeline
enable
:admin_group_runners
enable
:register_group_runners
enable
:admin_build
enable
:admin_build
enable
:read_cluster
enable
:read_cluster
enable
:add_cluster
enable
:add_cluster
...
@@ -182,6 +180,8 @@ class GroupPolicy < Namespaces::GroupProjectNamespaceSharedPolicy
...
@@ -182,6 +180,8 @@ class GroupPolicy < Namespaces::GroupProjectNamespaceSharedPolicy
enable
:change_visibility_level
enable
:change_visibility_level
enable
:read_group_runners
enable
:read_group_runners
enable
:admin_group_runners
enable
:register_group_runners
enable
:set_note_created_at
enable
:set_note_created_at
enable
:set_emails_disabled
enable
:set_emails_disabled
...
...
app/views/projects/runners/_group_runners.html.haml
View file @
aa65354d
...
@@ -29,9 +29,9 @@
...
@@ -29,9 +29,9 @@
-
if
can?
(
current_user
,
:admin_group_runners
,
@project
.
group
)
-
if
can?
(
current_user
,
:admin_group_runners
,
@project
.
group
)
-
group_link
=
link_to
_
(
"group's CI/CD settings."
),
group_settings_ci_cd_path
(
@project
.
group
)
-
group_link
=
link_to
_
(
"group's CI/CD settings."
),
group_settings_ci_cd_path
(
@project
.
group
)
=
_
(
'Group
maintai
ners can register group runners in the %{link}'
).
html_safe
%
{
link:
group_link
}
=
_
(
'Group
ow
ners can register group runners in the %{link}'
).
html_safe
%
{
link:
group_link
}
-
else
-
else
=
_
(
'Ask your group
maintai
ner to set up a group runner.'
)
=
_
(
'Ask your group
ow
ner to set up a group runner.'
)
-
else
-
else
%h4
.underlined-title
%h4
.underlined-title
...
...
locale/gitlab.pot
View file @
aa65354d
...
@@ -4796,7 +4796,7 @@ msgstr ""
...
@@ -4796,7 +4796,7 @@ msgstr ""
msgid "Ask someone with write access to resolve it."
msgid "Ask someone with write access to resolve it."
msgstr ""
msgstr ""
msgid "Ask your group
maintai
ner to set up a group runner."
msgid "Ask your group
ow
ner to set up a group runner."
msgstr ""
msgstr ""
msgid "Assertion consumer service URL"
msgid "Assertion consumer service URL"
...
@@ -16721,9 +16721,6 @@ msgstr ""
...
@@ -16721,9 +16721,6 @@ msgstr ""
msgid "Group jobs by"
msgid "Group jobs by"
msgstr ""
msgstr ""
msgid "Group maintainers can register group runners in the %{link}"
msgstr ""
msgid "Group members"
msgid "Group members"
msgstr ""
msgstr ""
...
@@ -16748,6 +16745,9 @@ msgstr ""
...
@@ -16748,6 +16745,9 @@ msgstr ""
msgid "Group overview content"
msgid "Group overview content"
msgstr ""
msgstr ""
msgid "Group owners can register group runners in the %{link}"
msgstr ""
msgid "Group path is already taken. We've suggested one that is available."
msgid "Group path is already taken. We've suggested one that is available."
msgstr ""
msgstr ""
...
...
spec/features/runners_spec.rb
View file @
aa65354d
...
@@ -268,10 +268,27 @@ RSpec.describe 'Runners' do
...
@@ -268,10 +268,27 @@ RSpec.describe 'Runners' do
it
'group runners are not available'
do
it
'group runners are not available'
do
visit
project_runners_path
(
project
)
visit
project_runners_path
(
project
)
expect
(
page
).
not_to
have_content
'Group owners can register group runners in the group\'s CI/CD settings.'
expect
(
page
).
to
have_content
'Ask your group owner to set up a group runner'
end
end
end
context
'as project maintainer and group owner'
do
before
do
group
.
add_owner
(
user
)
end
context
'project with a group but no group runner'
do
let
(
:project
)
{
create
:project
,
group:
group
}
it
'group runners are available'
do
visit
project_runners_path
(
project
)
expect
(
page
).
to
have_content
'This group does not have any group runners yet.'
expect
(
page
).
to
have_content
'This group does not have any group runners yet.'
expect
(
page
).
to
have_content
'Group
maintai
ners can register group runners in the group\'s CI/CD settings.'
expect
(
page
).
to
have_content
'Group
ow
ners can register group runners in the group\'s CI/CD settings.'
expect
(
page
).
not_to
have_content
'Ask your group
maintai
ner to set up a group runner'
expect
(
page
).
not_to
have_content
'Ask your group
ow
ner to set up a group runner'
end
end
end
end
end
end
...
@@ -296,8 +313,8 @@ RSpec.describe 'Runners' do
...
@@ -296,8 +313,8 @@ RSpec.describe 'Runners' do
expect
(
page
).
to
have_content
'This group does not have any group runners yet.'
expect
(
page
).
to
have_content
'This group does not have any group runners yet.'
expect
(
page
).
not_to
have_content
'Group
maintai
ners can register group runners in the group\'s CI/CD settings.'
expect
(
page
).
not_to
have_content
'Group
ow
ners can register group runners in the group\'s CI/CD settings.'
expect
(
page
).
to
have_content
'Ask your group
maintai
ner to set up a group runner.'
expect
(
page
).
to
have_content
'Ask your group
ow
ner to set up a group runner.'
end
end
end
end
...
...
spec/policies/group_policy_spec.rb
View file @
aa65354d
...
@@ -1085,9 +1085,7 @@ RSpec.describe GroupPolicy do
...
@@ -1085,9 +1085,7 @@ RSpec.describe GroupPolicy do
context
'with maintainer'
do
context
'with maintainer'
do
let
(
:current_user
)
{
maintainer
}
let
(
:current_user
)
{
maintainer
}
it
{
is_expected
.
to
be_allowed
(
:register_group_runners
)
}
it
{
is_expected
.
to
be_disallowed
(
:register_group_runners
)
}
it_behaves_like
'expected outcome based on runner registration control'
end
end
context
'with reporter'
do
context
'with reporter'
do
...
...
spec/support/shared_contexts/policies/group_policy_shared_context.rb
View file @
aa65354d
...
@@ -48,7 +48,6 @@ RSpec.shared_context 'GroupPolicy context' do
...
@@ -48,7 +48,6 @@ RSpec.shared_context 'GroupPolicy context' do
destroy_package
destroy_package
create_projects
create_projects
read_cluster create_cluster update_cluster admin_cluster add_cluster
read_cluster create_cluster update_cluster admin_cluster add_cluster
admin_group_runners
]
]
end
end
...
@@ -64,6 +63,8 @@ RSpec.shared_context 'GroupPolicy context' do
...
@@ -64,6 +63,8 @@ RSpec.shared_context 'GroupPolicy context' do
read_statistics
read_statistics
update_default_branch_protection
update_default_branch_protection
read_group_runners
read_group_runners
admin_group_runners
register_group_runners
]
]
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