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
2ca4981a
Commit
2ca4981a
authored
Dec 29, 2021
by
Pedro Pombeiro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add read_group_runners permissions
Replaces admin_group usage
parent
4328f801
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
15 deletions
+18
-15
app/finders/ci/runners_finder.rb
app/finders/ci/runners_finder.rb
+1
-1
app/policies/group_policy.rb
app/policies/group_policy.rb
+2
-0
lib/sidebars/groups/menus/ci_cd_menu.rb
lib/sidebars/groups/menus/ci_cd_menu.rb
+1
-3
spec/policies/group_policy_spec.rb
spec/policies/group_policy_spec.rb
+2
-0
spec/support/shared_contexts/policies/group_policy_shared_context.rb
...t/shared_contexts/policies/group_policy_shared_context.rb
+12
-11
No files found.
app/finders/ci/runners_finder.rb
View file @
2ca4981a
...
...
@@ -47,7 +47,7 @@ module Ci
end
def
group_runners
raise
Gitlab
::
Access
::
AccessDeniedError
unless
can?
(
@current_user
,
:
admin_group
,
@group
)
raise
Gitlab
::
Access
::
AccessDeniedError
unless
can?
(
@current_user
,
:
read_group_runners
,
@group
)
@runners
=
case
@params
[
:membership
]
when
:direct
...
...
app/policies/group_policy.rb
View file @
2ca4981a
...
...
@@ -180,6 +180,8 @@ class GroupPolicy < Namespaces::GroupProjectNamespaceSharedPolicy
enable
:admin_group_member
enable
:change_visibility_level
enable
:read_group_runners
enable
:set_note_created_at
enable
:set_emails_disabled
enable
:change_prevent_sharing_groups_outside_hierarchy
...
...
lib/sidebars/groups/menus/ci_cd_menu.rb
View file @
2ca4981a
...
...
@@ -34,10 +34,8 @@ module Sidebars
)
end
# TODO Proper policies, such as `read_group_runners`, should be implemented per
# See https://gitlab.com/gitlab-org/gitlab/-/issues/334802
def
show_runners?
can?
(
context
.
current_user
,
:
admin_group
,
context
.
group
)
&&
can?
(
context
.
current_user
,
:
read_group_runners
,
context
.
group
)
&&
Feature
.
enabled?
(
:runner_list_group_view_vue_ui
,
context
.
group
,
default_enabled: :yaml
)
end
end
...
...
spec/policies/group_policy_spec.rb
View file @
2ca4981a
...
...
@@ -36,6 +36,7 @@ RSpec.describe GroupPolicy do
it
{
expect_disallowed
(
:read_crm_organization
)
}
it
{
expect_disallowed
(
:read_crm_contact
)
}
it
{
expect_disallowed
(
:read_counts
)
}
it
{
expect_disallowed
(
:read_group_runners
)
}
it
{
expect_disallowed
(
*
read_group_permissions
)
}
end
...
...
@@ -51,6 +52,7 @@ RSpec.describe GroupPolicy do
it
{
expect_disallowed
(
:read_crm_organization
)
}
it
{
expect_disallowed
(
:read_crm_contact
)
}
it
{
expect_disallowed
(
:read_counts
)
}
it
{
expect_disallowed
(
:read_group_runners
)
}
it
{
expect_disallowed
(
*
read_group_permissions
)
}
end
...
...
spec/support/shared_contexts/policies/group_policy_shared_context.rb
View file @
2ca4981a
...
...
@@ -53,17 +53,18 @@ RSpec.shared_context 'GroupPolicy context' do
end
let
(
:owner_permissions
)
do
[
:owner_access
,
:admin_group
,
:admin_namespace
,
:admin_group_member
,
:change_visibility_level
,
:set_note_created_at
,
:create_subgroup
,
:read_statistics
,
:update_default_branch_protection
].
compact
%i[
owner_access
admin_group
admin_namespace
admin_group_member
change_visibility_level
set_note_created_at
create_subgroup
read_statistics
update_default_branch_protection
read_group_runners
]
end
let
(
:admin_permissions
)
{
%i[read_confidential_issues]
}
...
...
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