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
Hide 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
enable
:destroy_package
enable
:create_projects
enable
:admin_pipeline
enable
:admin_group_runners
enable
:register_group_runners
enable
:admin_build
enable
:read_cluster
enable
:add_cluster
...
...
@@ -182,6 +180,8 @@ class GroupPolicy < Namespaces::GroupProjectNamespaceSharedPolicy
enable
:change_visibility_level
enable
:read_group_runners
enable
:admin_group_runners
enable
:register_group_runners
enable
:set_note_created_at
enable
:set_emails_disabled
...
...
app/views/projects/runners/_group_runners.html.haml
View file @
aa65354d
...
...
@@ -29,9 +29,9 @@
-
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
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
=
_
(
'Ask your group
maintai
ner to set up a group runner.'
)
=
_
(
'Ask your group
ow
ner to set up a group runner.'
)
-
else
%h4
.underlined-title
...
...
locale/gitlab.pot
View file @
aa65354d
...
...
@@ -4796,7 +4796,7 @@ msgstr ""
msgid "Ask someone with write access to resolve it."
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 ""
msgid "Assertion consumer service URL"
...
...
@@ -16721,9 +16721,6 @@ msgstr ""
msgid "Group jobs by"
msgstr ""
msgid "Group maintainers can register group runners in the %{link}"
msgstr ""
msgid "Group members"
msgstr ""
...
...
@@ -16748,6 +16745,9 @@ msgstr ""
msgid "Group overview content"
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."
msgstr ""
...
...
spec/features/runners_spec.rb
View file @
aa65354d
...
...
@@ -268,10 +268,27 @@ RSpec.describe 'Runners' do
it
'group runners are not available'
do
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
'Group
maintai
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
).
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
ow
ner to set up a group runner'
end
end
end
...
...
@@ -296,8 +313,8 @@ RSpec.describe 'Runners' do
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
).
to
have_content
'Ask your group
maintai
ner to set up a group runner.'
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
ow
ner to set up a group runner.'
end
end
...
...
spec/policies/group_policy_spec.rb
View file @
aa65354d
...
...
@@ -1085,9 +1085,7 @@ RSpec.describe GroupPolicy do
context
'with maintainer'
do
let
(
:current_user
)
{
maintainer
}
it
{
is_expected
.
to
be_allowed
(
:register_group_runners
)
}
it_behaves_like
'expected outcome based on runner registration control'
it
{
is_expected
.
to
be_disallowed
(
:register_group_runners
)
}
end
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
destroy_package
create_projects
read_cluster create_cluster update_cluster admin_cluster add_cluster
admin_group_runners
]
end
...
...
@@ -64,6 +63,8 @@ RSpec.shared_context 'GroupPolicy context' do
read_statistics
update_default_branch_protection
read_group_runners
admin_group_runners
register_group_runners
]
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