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
67394ec2
Commit
67394ec2
authored
Apr 30, 2021
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix authorizations for epic boards
- move the authorization check to the concern - fix the specs
parent
4c0d2649
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
5 deletions
+47
-5
app/controllers/concerns/boards_actions.rb
app/controllers/concerns/boards_actions.rb
+1
-0
app/controllers/groups/boards_controller.rb
app/controllers/groups/boards_controller.rb
+0
-1
app/controllers/projects/boards_controller.rb
app/controllers/projects/boards_controller.rb
+0
-1
ee/app/controllers/groups/epic_boards_controller.rb
ee/app/controllers/groups/epic_boards_controller.rb
+0
-1
ee/spec/controllers/groups/epic_boards_controller_spec.rb
ee/spec/controllers/groups/epic_boards_controller_spec.rb
+46
-2
No files found.
app/controllers/concerns/boards_actions.rb
View file @
67394ec2
...
...
@@ -7,6 +7,7 @@ module BoardsActions
included
do
include
BoardsResponses
before_action
:authorize_read_board!
,
only:
[
:index
,
:show
]
before_action
:boards
,
only: :index
before_action
:board
,
only: :show
before_action
:push_licensed_features
,
only:
[
:index
,
:show
]
...
...
app/controllers/groups/boards_controller.rb
View file @
67394ec2
...
...
@@ -5,7 +5,6 @@ class Groups::BoardsController < Groups::ApplicationController
include
RecordUserLastActivity
include
Gitlab
::
Utils
::
StrongMemoize
before_action
:authorize_read_board!
,
only:
[
:index
,
:show
]
before_action
:assign_endpoint_vars
before_action
do
push_frontend_feature_flag
(
:graphql_board_lists
,
group
,
default_enabled:
false
)
...
...
app/controllers/projects/boards_controller.rb
View file @
67394ec2
...
...
@@ -5,7 +5,6 @@ class Projects::BoardsController < Projects::ApplicationController
include
IssuableCollections
before_action
:check_issues_available!
before_action
:authorize_read_board!
,
only:
[
:index
,
:show
]
before_action
:assign_endpoint_vars
before_action
do
push_frontend_feature_flag
(
:swimlanes_buffered_rendering
,
project
,
default_enabled: :yaml
)
...
...
ee/app/controllers/groups/epic_boards_controller.rb
View file @
67394ec2
...
...
@@ -5,7 +5,6 @@ class Groups::EpicBoardsController < Groups::ApplicationController
include
Gitlab
::
Utils
::
StrongMemoize
extend
::
Gitlab
::
Utils
::
Override
before_action
:authorize_read_board!
,
only:
[
:index
]
before_action
:assign_endpoint_vars
before_action
do
push_frontend_feature_flag
(
:epic_boards
,
group
,
default_enabled: :yaml
)
...
...
ee/spec/controllers/groups/epic_boards_controller_spec.rb
View file @
67394ec2
...
...
@@ -11,20 +11,52 @@ RSpec.describe Groups::EpicBoardsController do
let
(
:group
)
{
public_group
}
before
do
stub_licensed_features
(
epics:
true
)
group
.
add_maintainer
(
user
)
sign_in
(
user
)
end
describe
'GET index'
do
it
'creates a new board when group does not have one'
do
expect
{
list_boards
}.
to
change
(
group
.
epic_boards
,
:count
).
by
(
1
)
context
'with epics disabled'
do
before
do
stub_licensed_features
(
epics:
false
)
end
it
'does not create a new board when group does not have one'
do
expect
{
list_boards
}.
not_to
change
(
group
.
epic_boards
,
:count
)
end
it
'returns a not found 404 response'
do
list_boards
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'with authorized user'
do
it
'creates a new board when group does not have one'
do
expect
{
list_boards
}.
to
change
(
group
.
epic_boards
,
:count
).
by
(
1
)
end
it
'returns correct response'
do
list_boards
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
context
'with unauthorized user'
do
let_it_be
(
:group
)
{
private_group
}
before
do
sign_in
(
other_user
)
end
it
'does not create a new board when group does not have one'
do
expect
{
list_boards
}.
not_to
change
(
group
.
epic_boards
,
:count
)
end
it
'returns a not found 404 response'
do
list_boards
...
...
@@ -53,6 +85,18 @@ RSpec.describe Groups::EpicBoardsController do
describe
'GET show'
do
let!
(
:board
)
{
create
(
:epic_board
,
group:
group
)
}
context
'with epics disabled'
do
before
do
stub_licensed_features
(
epics:
false
)
end
it
'returns a not found 404 response'
do
read_board
(
board:
board
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'json request'
do
it
'is not supported'
do
read_board
(
board:
board
,
format: :json
)
...
...
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