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
ba148a20
Commit
ba148a20
authored
Dec 29, 2021
by
Pedro Pombeiro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use new rules instead of admin_group in controller
parent
2ca4981a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
app/controllers/groups/application_controller.rb
app/controllers/groups/application_controller.rb
+12
-0
app/controllers/groups/runners_controller.rb
app/controllers/groups/runners_controller.rb
+3
-4
No files found.
app/controllers/groups/application_controller.rb
View file @
ba148a20
...
@@ -37,6 +37,18 @@ class Groups::ApplicationController < ApplicationController
...
@@ -37,6 +37,18 @@ class Groups::ApplicationController < ApplicationController
end
end
end
end
def
authorize_admin_group_runners!
unless
can?
(
current_user
,
:admin_group_runners
,
group
)
render_404
end
end
def
authorize_read_group_runners!
unless
can?
(
current_user
,
:read_group_runners
,
group
)
render_404
end
end
def
authorize_create_deploy_token!
def
authorize_create_deploy_token!
unless
can?
(
current_user
,
:create_deploy_token
,
group
)
unless
can?
(
current_user
,
:create_deploy_token
,
group
)
render_404
render_404
...
...
app/controllers/groups/runners_controller.rb
View file @
ba148a20
# frozen_string_literal: true
# frozen_string_literal: true
class
Groups::RunnersController
<
Groups
::
ApplicationController
class
Groups::RunnersController
<
Groups
::
ApplicationController
# TODO Proper policies, such as `read_group_runners, should be implemented per
before_action
:authorize_read_group_runners!
,
only:
[
:index
,
:show
]
# https://gitlab.com/gitlab-org/gitlab/-/issues/334802
before_action
:authorize_admin_group_runners!
,
only:
[
:edit
,
:update
,
:destroy
,
:pause
,
:resume
]
before_action
:authorize_admin_group!
before_action
:runner_list_group_view_vue_ui_enabled
,
only:
[
:index
]
before_action
:runner_list_group_view_vue_ui_enabled
,
only:
[
:index
]
before_action
:runner
,
only:
[
:edit
,
:update
,
:destroy
,
:pause
,
:resume
,
:show
]
before_action
:runner
,
only:
[
:edit
,
:update
,
:destroy
,
:pause
,
:resume
,
:show
]
...
@@ -17,7 +16,7 @@ class Groups::RunnersController < Groups::ApplicationController
...
@@ -17,7 +16,7 @@ class Groups::RunnersController < Groups::ApplicationController
end
end
def
runner_list_group_view_vue_ui_enabled
def
runner_list_group_view_vue_ui_enabled
re
turn
re
nder_404
unless
Feature
.
enabled?
(
:runner_list_group_view_vue_ui
,
group
,
default_enabled: :yaml
)
render_404
unless
Feature
.
enabled?
(
:runner_list_group_view_vue_ui
,
group
,
default_enabled: :yaml
)
end
end
def
show
def
show
...
...
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