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
6e9f841a
Commit
6e9f841a
authored
Jul 28, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code improvements plus changelog
parent
215c15bf
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
71 additions
and
73 deletions
+71
-73
app/controllers/boards/application_controller.rb
app/controllers/boards/application_controller.rb
+0
-1
app/controllers/boards/issues_controller.rb
app/controllers/boards/issues_controller.rb
+4
-5
app/controllers/boards/lists_controller.rb
app/controllers/boards/lists_controller.rb
+4
-4
app/controllers/concerns/boards_authorizations.rb
app/controllers/concerns/boards_authorizations.rb
+0
-32
app/controllers/concerns/boards_responses.rb
app/controllers/concerns/boards_responses.rb
+48
-0
app/controllers/ee/boards/boards_controller.rb
app/controllers/ee/boards/boards_controller.rb
+1
-1
app/controllers/groups/boards_controller.rb
app/controllers/groups/boards_controller.rb
+3
-13
app/controllers/groups/labels_controller.rb
app/controllers/groups/labels_controller.rb
+3
-3
app/controllers/projects/boards_controller.rb
app/controllers/projects/boards_controller.rb
+3
-13
app/helpers/boards_helper.rb
app/helpers/boards_helper.rb
+1
-1
changelogs/unreleased-ee/issue_928_group_boards.yml
changelogs/unreleased-ee/issue_928_group_boards.yml
+4
-0
No files found.
app/controllers/boards/application_controller.rb
View file @
6e9f841a
...
...
@@ -19,4 +19,3 @@ module Boards
end
end
end
app/controllers/boards/issues_controller.rb
View file @
6e9f841a
module
Boards
class
IssuesController
<
Boards
::
ApplicationController
include
Boards
Authorization
s
include
Boards
Response
s
before_action
:authorize_read_issue
!
,
only:
[
:index
]
before_action
:authorize_create_issue
!
,
only:
[
:create
]
before_action
:authorize_update_issue
!
,
only:
[
:update
]
before_action
:authorize_read_issue
,
only:
[
:index
]
before_action
:authorize_create_issue
,
only:
[
:create
]
before_action
:authorize_update_issue
,
only:
[
:update
]
def
index
issues
=
Boards
::
Issues
::
ListService
.
new
(
board_parent
,
current_user
,
filter_params
).
execute
...
...
@@ -83,4 +83,3 @@ module Boards
end
end
end
app/controllers/boards/lists_controller.rb
View file @
6e9f841a
module
Boards
class
ListsController
<
Boards
::
ApplicationController
include
Boards
Authorization
s
include
Boards
Response
s
before_action
:authorize_admin_list
!
,
only:
[
:create
,
:update
,
:destroy
,
:generate
]
before_action
:authorize_read_list
!
,
only:
[
:index
]
before_action
:authorize_admin_list
,
only:
[
:create
,
:update
,
:destroy
,
:generate
]
before_action
:authorize_read_list
,
only:
[
:index
]
def
index
lists
=
Boards
::
Lists
::
ListService
.
new
(
board
.
parent
,
current_user
).
execute
(
board
)
...
...
@@ -12,7 +12,7 @@ module Boards
end
def
create
list
=
::
Boards
::
Lists
::
CreateService
.
new
(
board
.
parent
,
current_user
,
list_params
).
execute
(
board
)
list
=
Boards
::
Lists
::
CreateService
.
new
(
board
.
parent
,
current_user
,
list_params
).
execute
(
board
)
if
list
.
valid?
render
json:
serialize_as_json
(
list
)
...
...
app/controllers/concerns/boards_authorizations.rb
deleted
100644 → 0
View file @
215c15bf
module
BoardsAuthorizations
# Shared authorizations between projects and groups which
# have different policies.
def
authorize_read_list!
ability
=
board
.
is_group_board?
?
:read_group
:
:read_list
return
render_403
unless
action_allowed_for?
(
board
.
parent
,
ability
)
end
def
authorize_read_issue!
ability
=
board
.
is_group_board?
?
:read_group
:
:read_issue
return
render_403
unless
action_allowed_for?
(
board
.
parent
,
ability
)
end
def
authorize_update_issue!
return
render_403
unless
action_allowed_for?
(
issue
,
:admin_issue
)
end
def
authorize_create_issue!
return
render_403
unless
action_allowed_for?
(
board
.
parent
,
:admin_issue
)
end
def
authorize_admin_list!
return
render_403
unless
action_allowed_for?
(
board
.
parent
,
:admin_list
)
end
def
action_allowed_for?
(
resource
,
ability
)
can?
(
current_user
,
ability
,
resource
)
end
end
app/controllers/concerns/boards_responses.rb
0 → 100644
View file @
6e9f841a
module
BoardsResponses
# Shared authorizations between projects and groups which
# have different policies.
def
authorize_read_list
ability
=
board
.
is_group_board?
?
:read_group
:
:read_list
authorize_action_for!
(
board
.
parent
,
ability
)
end
def
authorize_read_issue
ability
=
board
.
is_group_board?
?
:read_group
:
:read_issue
authorize_action_for!
(
board
.
parent
,
ability
)
end
def
authorize_update_issue
authorize_action_for!
(
issue
,
:admin_issue
)
end
def
authorize_create_issue
authorize_action_for!
(
board
.
parent
,
:admin_issue
)
end
def
authorize_admin_list
authorize_action_for!
(
board
.
parent
,
:admin_list
)
end
def
authorize_action_for!
(
resource
,
ability
)
return
render_403
unless
can?
(
current_user
,
ability
,
resource
)
end
def
respond_with_boards
respond_with
(
@boards
)
end
def
respond_with_board
respond_with
(
@board
)
end
def
respond_with
(
resource
)
respond_to
do
|
format
|
format
.
html
format
.
json
do
render
json:
serialize_as_json
(
resource
)
end
end
end
end
app/controllers/ee/boards/boards_controller.rb
View file @
6e9f841a
...
...
@@ -66,7 +66,7 @@ module EE
end
def
boards_path
if
parent
.
is_a?
(
Group
)
if
@group
group_boards_path
(
parent
)
else
project_boards_path
(
parent
)
...
...
app/controllers/groups/boards_controller.rb
View file @
6e9f841a
class
Groups::BoardsController
<
Groups
::
ApplicationController
prepend
EE
::
Boards
::
BoardsController
include
BoardsResponses
before_action
:check_group_issue_boards_available!
before_action
:assign_endpoint_vars
...
...
@@ -7,28 +8,17 @@ class Groups::BoardsController < Groups::ApplicationController
def
index
@boards
=
Boards
::
ListService
.
new
(
group
,
current_user
).
execute
respond_to
do
|
format
|
format
.
html
format
.
json
do
render
json:
serialize_as_json
(
@boards
)
end
end
respond_with_boards
end
def
show
@board
=
group
.
boards
.
find
(
params
[
:id
])
respond_to
do
|
format
|
format
.
html
format
.
json
do
render
json:
serialize_as_json
(
@board
)
end
end
respond_with_board
end
def
assign_endpoint_vars
@boards_endpoint
=
group_boards_path
(
group
)
@issues_path
=
issues_group_path
(
group
)
@bulk_issues_path
=
""
end
end
app/controllers/groups/labels_controller.rb
View file @
6e9f841a
...
...
@@ -15,10 +15,10 @@ class Groups::LabelsController < Groups::ApplicationController
format
.
json
do
available_labels
=
if
params
[
:group_labels_only
]
LabelsFinder
.
new
(
current_user
,
group_id:
@group
.
id
).
execute
else
if
params
[
:only_group_labels
]
group
.
labels
else
LabelsFinder
.
new
(
current_user
,
group_id:
@group
.
id
).
execute
end
render
json:
LabelSerializer
.
new
.
represent_appearance
(
available_labels
)
...
...
app/controllers/projects/boards_controller.rb
View file @
6e9f841a
class
Projects::BoardsController
<
Projects
::
ApplicationController
prepend
EE
::
Boards
::
BoardsController
include
IssuableCollections
include
BoardsResponses
before_action
:authorize_read_board!
,
only:
[
:index
,
:show
]
before_action
:assign_endpoint_vars
...
...
@@ -8,23 +9,13 @@ class Projects::BoardsController < Projects::ApplicationController
def
index
@boards
=
Boards
::
ListService
.
new
(
project
,
current_user
).
execute
respond_to
do
|
format
|
format
.
html
format
.
json
do
render
json:
serialize_as_json
(
@boards
)
end
end
respond_with_boards
end
def
show
@board
=
project
.
boards
.
find
(
params
[
:id
])
respond_to
do
|
format
|
format
.
html
format
.
json
do
render
json:
serialize_as_json
(
@board
)
end
end
respond_with_boards
end
private
...
...
@@ -32,7 +23,6 @@ class Projects::BoardsController < Projects::ApplicationController
def
assign_endpoint_vars
@boards_endpoint
=
project_boards_path
(
project
)
@issues_path
=
project_issues_path
(
project
)
@bulk_issues_path
=
bulk_update_project_issues_path
(
@project
)
end
...
...
app/helpers/boards_helper.rb
View file @
6e9f841a
...
...
@@ -59,7 +59,7 @@ module BoardsHelper
{
toggle:
"dropdown"
,
labels:
labels_filter_path
(
only_group_labels:
true
),
labels:
labels_filter_path
(
true
),
namespace_path:
namespace_path
,
project_path:
@project
&
.
try
(
:path
),
# Change this one on JS to use a single property: parent_path
group_path:
@group
&
.
try
(
:path
)
# Same here
...
...
changelogs/unreleased-ee/issue_928_group_boards.yml
0 → 100644
View file @
6e9f841a
---
title
:
Add group issue boards
merge_request
:
author
:
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