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
1cca0e9c
Commit
1cca0e9c
authored
Feb 24, 2021
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename issue boards permissions
Improve name of issue board policy permissions
parent
cd40c625
Changes
41
Show whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
89 additions
and
88 deletions
+89
-88
app/controllers/concerns/boards_responses.rb
app/controllers/concerns/boards_responses.rb
+2
-2
app/controllers/concerns/multiple_boards_actions.rb
app/controllers/concerns/multiple_boards_actions.rb
+1
-1
app/controllers/groups/boards_controller.rb
app/controllers/groups/boards_controller.rb
+1
-1
app/controllers/projects/boards_controller.rb
app/controllers/projects/boards_controller.rb
+1
-1
app/graphql/mutations/boards/create.rb
app/graphql/mutations/boards/create.rb
+1
-1
app/graphql/mutations/boards/destroy.rb
app/graphql/mutations/boards/destroy.rb
+1
-1
app/graphql/mutations/boards/issues/issue_move_list.rb
app/graphql/mutations/boards/issues/issue_move_list.rb
+1
-1
app/graphql/mutations/boards/lists/create.rb
app/graphql/mutations/boards/lists/create.rb
+1
-1
app/graphql/mutations/boards/lists/destroy.rb
app/graphql/mutations/boards/lists/destroy.rb
+1
-1
app/graphql/mutations/boards/lists/update.rb
app/graphql/mutations/boards/lists/update.rb
+1
-1
app/graphql/mutations/boards/update.rb
app/graphql/mutations/boards/update.rb
+1
-1
app/graphql/resolvers/board_lists_resolver.rb
app/graphql/resolvers/board_lists_resolver.rb
+1
-1
app/graphql/types/board_type.rb
app/graphql/types/board_type.rb
+1
-1
app/policies/concerns/readonly_abilities.rb
app/policies/concerns/readonly_abilities.rb
+1
-1
app/policies/group_policy.rb
app/policies/group_policy.rb
+4
-4
app/policies/project_policy.rb
app/policies/project_policy.rb
+10
-10
app/services/boards/lists/update_service.rb
app/services/boards/lists/update_service.rb
+2
-2
app/views/shared/boards/_show.html.haml
app/views/shared/boards/_show.html.haml
+1
-1
app/views/shared/boards/_switcher.html.haml
app/views/shared/boards/_switcher.html.haml
+1
-1
app/views/shared/issuable/_search_bar.html.haml
app/views/shared/issuable/_search_bar.html.haml
+2
-2
ee/app/graphql/mutations/boards/lists/update_limit_metrics.rb
...pp/graphql/mutations/boards/lists/update_limit_metrics.rb
+1
-1
ee/app/graphql/mutations/boards/update_epic_user_preferences.rb
.../graphql/mutations/boards/update_epic_user_preferences.rb
+1
-1
ee/app/policies/ee/group_policy.rb
ee/app/policies/ee/group_policy.rb
+2
-2
ee/app/policies/ee/project_policy.rb
ee/app/policies/ee/project_policy.rb
+2
-2
ee/app/policies/ee/readonly_abilities.rb
ee/app/policies/ee/readonly_abilities.rb
+1
-1
ee/lib/ee/api/group_boards.rb
ee/lib/ee/api/group_boards.rb
+2
-2
ee/spec/controllers/projects/boards_controller_spec.rb
ee/spec/controllers/projects/boards_controller_spec.rb
+3
-3
ee/spec/graphql/mutations/boards/update_spec.rb
ee/spec/graphql/mutations/boards/update_spec.rb
+1
-1
ee/spec/policies/group_policy_spec.rb
ee/spec/policies/group_policy_spec.rb
+1
-1
ee/spec/policies/project_policy_spec.rb
ee/spec/policies/project_policy_spec.rb
+4
-3
lib/api/boards.rb
lib/api/boards.rb
+10
-10
lib/api/group_boards.rb
lib/api/group_boards.rb
+8
-8
spec/controllers/groups/boards_controller_spec.rb
spec/controllers/groups/boards_controller_spec.rb
+3
-3
spec/controllers/projects/boards_controller_spec.rb
spec/controllers/projects/boards_controller_spec.rb
+4
-4
spec/graphql/mutations/boards/update_spec.rb
spec/graphql/mutations/boards/update_spec.rb
+1
-1
spec/graphql/types/board_type_spec.rb
spec/graphql/types/board_type_spec.rb
+1
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+1
-1
spec/policies/project_policy_spec.rb
spec/policies/project_policy_spec.rb
+2
-2
spec/support/shared_contexts/policies/group_policy_shared_context.rb
...t/shared_contexts/policies/group_policy_shared_context.rb
+2
-2
spec/support/shared_contexts/policies/project_policy_shared_context.rb
...shared_contexts/policies/project_policy_shared_context.rb
+3
-3
spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb
...graphql/group_and_project_boards_query_shared_examples.rb
+1
-1
No files found.
app/controllers/concerns/boards_responses.rb
View file @
1cca0e9c
...
...
@@ -35,7 +35,7 @@ module BoardsResponses
end
def
authorize_read_list
authorize_action_for!
(
board
,
:read_list
)
authorize_action_for!
(
board
,
:read_
issue_board_
list
)
end
def
authorize_read_issue
...
...
@@ -54,7 +54,7 @@ module BoardsResponses
end
def
authorize_admin_list
authorize_action_for!
(
board
,
:admin_list
)
authorize_action_for!
(
board
,
:admin_
issue_board_
list
)
end
def
authorize_action_for!
(
resource
,
ability
)
...
...
app/controllers/concerns/multiple_boards_actions.rb
View file @
1cca0e9c
...
...
@@ -80,7 +80,7 @@ module MultipleBoardsActions
end
def
authorize_admin_board!
return
render_404
unless
can?
(
current_user
,
:admin_board
,
parent
)
return
render_404
unless
can?
(
current_user
,
:admin_
issue_
board
,
parent
)
end
def
serializer
...
...
app/controllers/groups/boards_controller.rb
View file @
1cca0e9c
...
...
@@ -44,6 +44,6 @@ class Groups::BoardsController < Groups::ApplicationController
end
def
authorize_read_board!
access_denied!
unless
can?
(
current_user
,
:read_board
,
group
)
access_denied!
unless
can?
(
current_user
,
:read_
issue_
board
,
group
)
end
end
app/controllers/projects/boards_controller.rb
View file @
1cca0e9c
...
...
@@ -45,6 +45,6 @@ class Projects::BoardsController < Projects::ApplicationController
end
def
authorize_read_board!
access_denied!
unless
can?
(
current_user
,
:read_board
,
project
)
access_denied!
unless
can?
(
current_user
,
:read_
issue_
board
,
project
)
end
end
app/graphql/mutations/boards/create.rb
View file @
1cca0e9c
...
...
@@ -14,7 +14,7 @@ module Mutations
null:
true
,
description:
'The board after mutation.'
authorize
:admin_board
authorize
:admin_
issue_
board
def
resolve
(
args
)
board_parent
=
authorized_resource_parent_find!
(
args
)
...
...
app/graphql/mutations/boards/destroy.rb
View file @
1cca0e9c
...
...
@@ -14,7 +14,7 @@ module Mutations
required:
true
,
description:
'The global ID of the board to destroy.'
authorize
:admin_board
authorize
:admin_
issue_
board
def
resolve
(
id
:)
board
=
authorized_find!
(
id:
id
)
...
...
app/graphql/mutations/boards/issues/issue_move_list.rb
View file @
1cca0e9c
...
...
@@ -83,7 +83,7 @@ module Mutations
end
def
authorize_board!
(
board
)
return
if
Ability
.
allowed?
(
current_user
,
:read_board
,
board
.
resource_parent
)
return
if
Ability
.
allowed?
(
current_user
,
:read_
issue_
board
,
board
.
resource_parent
)
raise_resource_not_available_error!
end
...
...
app/graphql/mutations/boards/lists/create.rb
View file @
1cca0e9c
...
...
@@ -15,7 +15,7 @@ module Mutations
null:
true
,
description:
'Issue list in the issue board.'
authorize
:admin_list
authorize
:admin_
issue_board_
list
private
...
...
app/graphql/mutations/boards/lists/destroy.rb
View file @
1cca0e9c
...
...
@@ -33,7 +33,7 @@ module Mutations
def
can_admin_list?
(
list
)
return
false
unless
list
.
present?
Ability
.
allowed?
(
current_user
,
:admin_list
,
list
.
board
)
Ability
.
allowed?
(
current_user
,
:admin_
issue_board_
list
,
list
.
board
)
end
end
end
...
...
app/graphql/mutations/boards/lists/update.rb
View file @
1cca0e9c
...
...
@@ -44,7 +44,7 @@ module Mutations
def
can_read_list?
(
list
)
return
false
unless
list
.
present?
Ability
.
allowed?
(
current_user
,
:read_list
,
list
.
board
)
Ability
.
allowed?
(
current_user
,
:read_
issue_board_
list
,
list
.
board
)
end
end
end
...
...
app/graphql/mutations/boards/update.rb
View file @
1cca0e9c
...
...
@@ -17,7 +17,7 @@ module Mutations
null:
true
,
description:
'The board after mutation.'
authorize
:admin_board
authorize
:admin_
issue_
board
def
resolve
(
id
:,
**
args
)
board
=
authorized_find!
(
id:
id
)
...
...
app/graphql/resolvers/board_lists_resolver.rb
View file @
1cca0e9c
...
...
@@ -9,7 +9,7 @@ module Resolvers
type
Types
::
BoardListType
,
null:
true
extras
[
:lookahead
]
authorize
:read_list
authorize
:read_
issue_board_
list
argument
:id
,
Types
::
GlobalIDType
[
List
],
required:
false
,
...
...
app/graphql/types/board_type.rb
View file @
1cca0e9c
...
...
@@ -5,7 +5,7 @@ module Types
graphql_name
'Board'
description
'Represents a project or group issue board'
accepts
::
Board
authorize
:read_board
authorize
:read_
issue_
board
present_using
BoardPresenter
...
...
app/policies/concerns/readonly_abilities.rb
View file @
1cca0e9c
...
...
@@ -17,7 +17,7 @@ module ReadonlyAbilities
READONLY_FEATURES
=
%i[
issue
list
issue_board_
list
merge_request
label
milestone
...
...
app/policies/group_policy.rb
View file @
1cca0e9c
...
...
@@ -97,9 +97,9 @@ class GroupPolicy < BasePolicy
rule
{
can?
(
:read_group
)
}.
policy
do
enable
:read_milestone
enable
:read_list
enable
:read_
issue_board_
list
enable
:read_label
enable
:read_board
enable
:read_
issue_
board
enable
:read_group_member
enable
:read_custom_emoji
end
...
...
@@ -122,9 +122,9 @@ class GroupPolicy < BasePolicy
rule
{
reporter
}.
policy
do
enable
:reporter_access
enable
:read_container_image
enable
:admin_board
enable
:admin_
issue_
board
enable
:admin_label
enable
:admin_list
enable
:admin_
issue_board_
list
enable
:admin_issue
enable
:read_metrics_dashboard_annotation
enable
:read_prometheus
...
...
app/policies/project_policy.rb
View file @
1cca0e9c
...
...
@@ -204,8 +204,8 @@ class ProjectPolicy < BasePolicy
rule
{
can?
(
:guest_access
)
}.
policy
do
enable
:read_project
enable
:create_merge_request_in
enable
:read_board
enable
:read_list
enable
:read_
issue_
board
enable
:read_
issue_board_
list
enable
:read_wiki
enable
:read_issue
enable
:read_label
...
...
@@ -231,7 +231,7 @@ class ProjectPolicy < BasePolicy
rule
{
guest
&
can?
(
:read_container_image
)
}.
enable
:build_read_container_image
rule
{
can?
(
:reporter_access
)
}.
policy
do
enable
:admin_board
enable
:admin_
issue_
board
enable
:download_code
enable
:read_statistics
enable
:download_wiki_code
...
...
@@ -240,7 +240,7 @@ class ProjectPolicy < BasePolicy
enable
:reopen_issue
enable
:admin_issue
enable
:admin_label
enable
:admin_list
enable
:admin_
issue_board_
list
enable
:admin_issue_link
enable
:read_commit_status
enable
:read_build
...
...
@@ -319,7 +319,7 @@ class ProjectPolicy < BasePolicy
rule
{
can?
(
:developer_access
)
}.
policy
do
enable
:create_package
enable
:admin_board
enable
:admin_
issue_
board
enable
:admin_merge_request
enable
:admin_milestone
enable
:update_merge_request
...
...
@@ -369,7 +369,7 @@ class ProjectPolicy < BasePolicy
rule
{
can?
(
:maintainer_access
)
}.
policy
do
enable
:destroy_package
enable
:admin_board
enable
:admin_
issue_
board
enable
:push_to_delete_protected_branch
enable
:update_snippet
enable
:admin_snippet
...
...
@@ -429,8 +429,8 @@ class ProjectPolicy < BasePolicy
rule
{
issues_disabled
}.
policy
do
prevent
(
*
create_read_update_admin_destroy
(
:issue
))
prevent
(
*
create_read_update_admin_destroy
(
:board
))
prevent
(
*
create_read_update_admin_destroy
(
:list
))
prevent
(
*
create_read_update_admin_destroy
(
:
issue_
board
))
prevent
(
*
create_read_update_admin_destroy
(
:
issue_board_
list
))
end
rule
{
merge_requests_disabled
|
repository_disabled
}.
policy
do
...
...
@@ -507,8 +507,8 @@ class ProjectPolicy < BasePolicy
rule
{
can?
(
:public_access
)
}.
policy
do
enable
:read_package
enable
:read_project
enable
:read_board
enable
:read_list
enable
:read_
issue_
board
enable
:read_
issue_board_
list
enable
:read_wiki
enable
:read_label
enable
:read_milestone
...
...
app/services/boards/lists/update_service.rb
View file @
1cca0e9c
...
...
@@ -47,11 +47,11 @@ module Boards
end
def
can_read?
(
list
)
Ability
.
allowed?
(
current_user
,
:read_list
,
parent
)
Ability
.
allowed?
(
current_user
,
:read_
issue_board_
list
,
parent
)
end
def
can_admin?
(
list
)
Ability
.
allowed?
(
current_user
,
:admin_list
,
parent
)
Ability
.
allowed?
(
current_user
,
:admin_
issue_board_
list
,
parent
)
end
end
end
...
...
app/views/shared/boards/_show.html.haml
View file @
1cca0e9c
...
...
@@ -2,7 +2,7 @@
-
group
=
local_assigns
.
fetch
(
:group
,
false
)
-# TODO: Move group_id and can_admin_list to the board store
See: https://gitlab.com/gitlab-org/gitlab/-/issues/213082
-
can_admin_list
=
can?
(
current_user
,
:admin_list
,
current_board_parent
)
==
true
-
can_admin_list
=
can?
(
current_user
,
:admin_
issue_board_
list
,
current_board_parent
)
==
true
-
@no_breadcrumb_container
=
true
-
@no_container
=
true
-
@content_class
=
"issue-boards-content js-focus-mode-board"
...
...
app/views/shared/boards/_switcher.html.haml
View file @
1cca0e9c
...
...
@@ -7,7 +7,7 @@
milestone_path:
milestones_filter_path
(
milestone_filter_opts
),
board_base_url:
board_base_url
,
has_missing_boards:
(
!
multiple_boards_available?
&&
current_board_parent
.
boards
.
size
>
1
).
to_s
,
can_admin_board:
can?
(
current_user
,
:admin_board
,
parent
).
to_s
,
can_admin_board:
can?
(
current_user
,
:admin_
issue_
board
,
parent
).
to_s
,
multiple_issue_boards_available:
parent
.
multiple_issue_boards_available?
.
to_s
,
labels_path:
labels_filter_path_with_defaults
(
only_group_labels:
true
,
include_descendant_groups:
true
),
labels_web_url:
parent
.
is_a?
(
Project
)
?
project_labels_path
(
@project
)
:
group_labels_path
(
@group
),
...
...
app/views/shared/issuable/_search_bar.html.haml
View file @
1cca0e9c
...
...
@@ -5,7 +5,7 @@
-
placeholder
=
local_assigns
[
:placeholder
]
||
_
(
'Search or filter results...'
)
-
is_not_boards_modal_or_productivity_analytics
=
type
!=
:boards_modal
&&
type
!=
:productivity_analytics
-
block_css_class
=
is_not_boards_modal_or_productivity_analytics
?
'row-content-block second-block'
:
''
-
user_can_admin_list
=
board
&&
can?
(
current_user
,
:admin_list
,
board
.
resource_parent
)
-
user_can_admin_list
=
board
&&
can?
(
current_user
,
:admin_
issue_board_
list
,
board
.
resource_parent
)
.issues-filters
{
class:
(
"w-100"
if
type
==
:boards_modal
)
}
.issues-details-filters.filtered-search-block.d-flex.flex-column.flex-lg-row
{
class:
block_css_class
,
"v-pre"
=>
type
==
:boards_modal
}
...
...
@@ -202,7 +202,7 @@
-
else
=
render
'shared/issuable/board_create_list_dropdown'
,
board:
board
-
if
@project
#js-add-issues-btn
{
data:
{
can_admin_list:
can?
(
current_user
,
:admin_list
,
@project
)
}
}
#js-add-issues-btn
{
data:
{
can_admin_list:
can?
(
current_user
,
:admin_
issue_board_
list
,
@project
)
}
}
#js-toggle-focus-btn
-
elsif
is_not_boards_modal_or_productivity_analytics
&&
show_sorting_dropdown
=
render
'shared/issuable/sort_dropdown'
ee/app/graphql/mutations/boards/lists/update_limit_metrics.rb
View file @
1cca0e9c
...
...
@@ -69,7 +69,7 @@ module Mutations
end
def
authorize_admin_rights!
raise_resource_not_available_error!
unless
Ability
.
allowed?
(
current_user
,
:admin_list
,
board
)
raise_resource_not_available_error!
unless
Ability
.
allowed?
(
current_user
,
:admin_
issue_board_
list
,
board
)
end
def
find_list_by_global_id
(
gid
)
...
...
ee/app/graphql/mutations/boards/update_epic_user_preferences.rb
View file @
1cca0e9c
...
...
@@ -25,7 +25,7 @@ module Mutations
null:
true
,
description:
'User preferences for the epic in the board after mutation.'
authorize
:read_board
authorize
:read_
issue_
board
def
resolve
(
board_id
:,
epic_id
:,
**
args
)
board
=
authorized_find!
(
id:
board_id
)
...
...
ee/app/policies/ee/group_policy.rb
View file @
1cca0e9c
...
...
@@ -144,7 +144,7 @@ module EE
end
rule
{
reporter
}.
policy
do
enable
:admin_list
enable
:admin_
issue_board_
list
enable
:view_productivity_analytics
enable
:view_type_of_work_charts
enable
:read_group_timelogs
...
...
@@ -341,7 +341,7 @@ module EE
prevent
:admin_milestone
prevent
:upload_file
prevent
:admin_label
prevent
:admin_list
prevent
:admin_
issue_board_
list
prevent
:admin_issue
prevent
:admin_pipeline
prevent
:add_cluster
...
...
ee/app/policies/ee/project_policy.rb
View file @
1cca0e9c
...
...
@@ -209,7 +209,7 @@ module EE
rule
{
can?
(
:guest_access
)
&
iterations_available
}.
enable
:read_iteration
rule
{
can?
(
:reporter_access
)
}.
policy
do
enable
:admin_board
enable
:admin_
issue_
board
enable
:admin_epic_issue
enable
:read_group_timelogs
end
...
...
@@ -217,7 +217,7 @@ module EE
rule
{
oncall_schedules_available
&
can?
(
:reporter_access
)
}.
enable
:read_incident_management_oncall_schedule
rule
{
can?
(
:developer_access
)
}.
policy
do
enable
:admin_board
enable
:admin_
issue_
board
enable
:read_vulnerability_feedback
enable
:create_vulnerability_feedback
enable
:destroy_vulnerability_feedback
...
...
ee/app/policies/ee/readonly_abilities.rb
View file @
1cca0e9c
...
...
@@ -10,7 +10,7 @@ module EE
]
.
freeze
READONLY_FEATURES_EE
=
%i[
board
issue_
board
issue_link
approvers
vulnerability_feedback
...
...
ee/lib/ee/api/group_boards.rb
View file @
1cca0e9c
...
...
@@ -34,7 +34,7 @@ module EE
requires
:name
,
type:
String
,
desc:
'The board name'
end
post
'/'
do
authorize!
(
:admin_board
,
board_parent
)
authorize!
(
:admin_
issue_
board
,
board_parent
)
create_board
end
...
...
@@ -44,7 +44,7 @@ module EE
success
::
API
::
Entities
::
Board
end
delete
'/:board_id'
do
authorize!
(
:admin_board
,
board_parent
)
authorize!
(
:admin_
issue_
board
,
board_parent
)
delete_board
end
...
...
ee/spec/controllers/projects/boards_controller_spec.rb
View file @
1cca0e9c
...
...
@@ -106,7 +106,7 @@ RSpec.describe Projects::BoardsController do
before
do
expect
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:log_in
,
:global
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:admin_board
,
project
).
and_return
(
false
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:admin_
issue_
board
,
project
).
and_return
(
false
)
end
it
'returns a not found 404 response'
do
...
...
@@ -185,7 +185,7 @@ RSpec.describe Projects::BoardsController do
before
do
expect
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:log_in
,
:global
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:admin_board
,
project
).
and_return
(
false
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:admin_
issue_
board
,
project
).
and_return
(
false
)
end
it
'returns a not found 404 response'
do
...
...
@@ -235,7 +235,7 @@ RSpec.describe Projects::BoardsController do
before
do
expect
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:log_in
,
:global
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:admin_board
,
project
).
and_return
(
false
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:admin_
issue_
board
,
project
).
and_return
(
false
)
end
it
'returns a not found 404 response'
do
...
...
ee/spec/graphql/mutations/boards/update_spec.rb
View file @
1cca0e9c
...
...
@@ -32,7 +32,7 @@ RSpec.describe Mutations::Boards::Update do
subject
{
mutation
.
resolve
(
**
mutation_params
)
}
specify
{
expect
(
described_class
).
to
require_graphql_authorizations
(
:admin_board
)
}
specify
{
expect
(
described_class
).
to
require_graphql_authorizations
(
:admin_
issue_
board
)
}
describe
'#resolve'
do
context
'when the user cannot admin the board'
do
...
...
ee/spec/policies/group_policy_spec.rb
View file @
1cca0e9c
...
...
@@ -1261,7 +1261,7 @@ RSpec.describe GroupPolicy do
let
(
:current_user
)
{
owner
}
let
(
:policies
)
do
%i[create_projects create_epic update_epic admin_milestone upload_file admin_label
admin_list admin_issue admin_pipeline add_cluster create_cluster update_cluster
admin_
issue_board_
list admin_issue admin_pipeline add_cluster create_cluster update_cluster
admin_cluster admin_group_member create_deploy_token create_subgroup]
end
...
...
ee/spec/policies/project_policy_spec.rb
View file @
1cca0e9c
...
...
@@ -34,7 +34,7 @@ RSpec.describe ProjectPolicy do
let
(
:auditor_permissions
)
do
%i[
download_code download_wiki_code read_project read_
board rea
d_list
download_code download_wiki_code read_project read_
issue_board read_issue_boar
d_list
read_project_for_iids read_issue_iid read_merge_request_iid read_wiki
read_issue read_label read_issue_link read_milestone read_iteration
read_snippet read_project_member read_note read_cycle_analytics
...
...
@@ -190,7 +190,7 @@ RSpec.describe ProjectPolicy do
end
it
'disables boards permissions'
do
expect_disallowed
:admin_board
expect_disallowed
:admin_
issue_
board
end
end
end
...
...
@@ -1635,7 +1635,8 @@ RSpec.describe ProjectPolicy do
# These are abilities that are not explicitly allowed by policies because most of them are not
# real abilities. They are prevented due to the use of create_update_admin helper method.
let
(
:abilities_not_currently_enabled
)
do
%i[create_merge_request create_list update_list create_label update_label create_milestone
%i[create_merge_request create_issue_board_list create_issue_board update_issue_board
update_issue_board_list create_label update_label create_milestone
update_milestone update_wiki update_design admin_design update_note
update_pipeline_schedule admin_pipeline_schedule create_trigger update_trigger
admin_trigger create_pages admin_release request_access create_board update_board
...
...
lib/api/boards.rb
View file @
1cca0e9c
...
...
@@ -30,7 +30,7 @@ module API
use
:pagination
end
get
'/'
do
authorize!
(
:read_board
,
user_project
)
authorize!
(
:read_
issue_
board
,
user_project
)
present
paginate
(
board_parent
.
boards
.
with_associations
),
with:
Entities
::
Board
end
...
...
@@ -39,7 +39,7 @@ module API
success
Entities
::
Board
end
get
'/:board_id'
do
authorize!
(
:read_board
,
user_project
)
authorize!
(
:read_
issue_
board
,
user_project
)
present
board
,
with:
Entities
::
Board
end
...
...
@@ -51,7 +51,7 @@ module API
requires
:name
,
type:
String
,
desc:
'The board name'
end
post
'/'
do
authorize!
(
:admin_board
,
board_parent
)
authorize!
(
:admin_
issue_
board
,
board_parent
)
create_board
end
...
...
@@ -64,7 +64,7 @@ module API
use
:update_params
end
put
'/:board_id'
do
authorize!
(
:admin_board
,
board_parent
)
authorize!
(
:admin_
issue_
board
,
board_parent
)
update_board
end
...
...
@@ -75,7 +75,7 @@ module API
end
delete
'/:board_id'
do
authorize!
(
:admin_board
,
board_parent
)
authorize!
(
:admin_
issue_
board
,
board_parent
)
delete_board
end
...
...
@@ -93,7 +93,7 @@ module API
use
:pagination
end
get
'/lists'
do
authorize!
(
:read_board
,
user_project
)
authorize!
(
:read_
issue_
board
,
user_project
)
present
paginate
(
board_lists
),
with:
Entities
::
List
end
...
...
@@ -105,7 +105,7 @@ module API
requires
:list_id
,
type:
Integer
,
desc:
'The ID of a list'
end
get
'/lists/:list_id'
do
authorize!
(
:read_board
,
user_project
)
authorize!
(
:read_
issue_
board
,
user_project
)
present
board_lists
.
find
(
params
[
:list_id
]),
with:
Entities
::
List
end
...
...
@@ -117,7 +117,7 @@ module API
use
:list_creation_params
end
post
'/lists'
do
authorize!
(
:admin_list
,
user_project
)
authorize!
(
:admin_
issue_board_
list
,
user_project
)
create_list
end
...
...
@@ -133,7 +133,7 @@ module API
put
'/lists/:list_id'
do
list
=
board_lists
.
find
(
params
[
:list_id
])
authorize!
(
:admin_list
,
user_project
)
authorize!
(
:admin_
issue_board_
list
,
user_project
)
move_list
(
list
)
end
...
...
@@ -146,7 +146,7 @@ module API
requires
:list_id
,
type:
Integer
,
desc:
'The ID of a board list'
end
delete
"/lists/:list_id"
do
authorize!
(
:admin_list
,
user_project
)
authorize!
(
:admin_
issue_board_
list
,
user_project
)
list
=
board_lists
.
find
(
params
[
:list_id
])
destroy_list
(
list
)
...
...
lib/api/group_boards.rb
View file @
1cca0e9c
...
...
@@ -30,7 +30,7 @@ module API
use
:pagination
end
get
'/'
do
authorize!
(
:read_board
,
user_group
)
authorize!
(
:read_
issue_
board
,
user_group
)
present
paginate
(
board_parent
.
boards
.
with_associations
),
with:
Entities
::
Board
end
...
...
@@ -39,7 +39,7 @@ module API
success
Entities
::
Board
end
get
'/:board_id'
do
authorize!
(
:read_board
,
user_group
)
authorize!
(
:read_
issue_
board
,
user_group
)
present
board
,
with:
Entities
::
Board
end
...
...
@@ -51,7 +51,7 @@ module API
use
:update_params
end
put
'/:board_id'
do
authorize!
(
:admin_board
,
board_parent
)
authorize!
(
:admin_
issue_
board
,
board_parent
)
update_board
end
...
...
@@ -69,7 +69,7 @@ module API
use
:pagination
end
get
'/lists'
do
authorize!
(
:read_board
,
user_group
)
authorize!
(
:read_
issue_
board
,
user_group
)
present
paginate
(
board_lists
),
with:
Entities
::
List
end
...
...
@@ -81,7 +81,7 @@ module API
requires
:list_id
,
type:
Integer
,
desc:
'The ID of a list'
end
get
'/lists/:list_id'
do
authorize!
(
:read_board
,
user_group
)
authorize!
(
:read_
issue_
board
,
user_group
)
present
board_lists
.
find
(
params
[
:list_id
]),
with:
Entities
::
List
end
...
...
@@ -93,7 +93,7 @@ module API
use
:list_creation_params
end
post
'/lists'
do
authorize!
(
:admin_list
,
user_group
)
authorize!
(
:admin_
issue_board_
list
,
user_group
)
create_list
end
...
...
@@ -109,7 +109,7 @@ module API
put
'/lists/:list_id'
do
list
=
board_lists
.
find
(
params
[
:list_id
])
authorize!
(
:admin_list
,
user_group
)
authorize!
(
:admin_
issue_board_
list
,
user_group
)
move_list
(
list
)
end
...
...
@@ -122,7 +122,7 @@ module API
requires
:list_id
,
type:
Integer
,
desc:
'The ID of a board list'
end
delete
"/lists/:list_id"
do
authorize!
(
:admin_list
,
user_group
)
authorize!
(
:admin_
issue_board_
list
,
user_group
)
list
=
board_lists
.
find
(
params
[
:list_id
])
destroy_list
(
list
)
...
...
spec/controllers/groups/boards_controller_spec.rb
View file @
1cca0e9c
...
...
@@ -29,7 +29,7 @@ RSpec.describe Groups::BoardsController do
expect
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:log_in
,
:global
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_cross_project
,
:global
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_group
,
group
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_board
,
group
).
and_return
(
false
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_
issue_
board
,
group
).
and_return
(
false
)
end
it
'returns a not found 404 response'
do
...
...
@@ -74,7 +74,7 @@ RSpec.describe Groups::BoardsController do
expect
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:log_in
,
:global
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_cross_project
,
:global
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_group
,
group
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_board
,
group
).
and_return
(
false
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_
issue_
board
,
group
).
and_return
(
false
)
end
it
'returns a not found 404 response'
do
...
...
@@ -111,7 +111,7 @@ RSpec.describe Groups::BoardsController do
expect
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:log_in
,
:global
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_cross_project
,
:global
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_group
,
group
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_board
,
group
).
and_return
(
false
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_
issue_
board
,
group
).
and_return
(
false
)
end
it
'returns a not found 404 response'
do
...
...
spec/controllers/projects/boards_controller_spec.rb
View file @
1cca0e9c
...
...
@@ -34,7 +34,7 @@ RSpec.describe Projects::BoardsController do
before
do
expect
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:log_in
,
:global
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_board
,
project
).
and_return
(
false
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_
issue_
board
,
project
).
and_return
(
false
)
end
it
'returns a not found 404 response'
do
...
...
@@ -78,7 +78,7 @@ RSpec.describe Projects::BoardsController do
before
do
expect
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:log_in
,
:global
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_board
,
project
).
and_return
(
false
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_
issue_
board
,
project
).
and_return
(
false
)
end
it
'returns a not found 404 response'
do
...
...
@@ -134,7 +134,7 @@ RSpec.describe Projects::BoardsController do
before
do
expect
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:log_in
,
:global
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_board
,
project
).
and_return
(
false
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_
issue_
board
,
project
).
and_return
(
false
)
end
it
'returns a not found 404 response'
do
...
...
@@ -172,7 +172,7 @@ RSpec.describe Projects::BoardsController do
before
do
expect
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:log_in
,
:global
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_board
,
project
).
and_return
(
false
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_
issue_
board
,
project
).
and_return
(
false
)
end
it
'returns a not found 404 response'
do
...
...
spec/graphql/mutations/boards/update_spec.rb
View file @
1cca0e9c
...
...
@@ -20,7 +20,7 @@ RSpec.describe Mutations::Boards::Update do
subject
{
mutation
.
resolve
(
**
mutation_params
)
}
specify
{
expect
(
described_class
).
to
require_graphql_authorizations
(
:admin_board
)
}
specify
{
expect
(
described_class
).
to
require_graphql_authorizations
(
:admin_
issue_
board
)
}
describe
'#resolve'
do
context
'when the user cannot admin the board'
do
...
...
spec/graphql/types/board_type_spec.rb
View file @
1cca0e9c
...
...
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec
.
describe
GitlabSchema
.
types
[
'Board'
]
do
specify
{
expect
(
described_class
.
graphql_name
).
to
eq
(
'Board'
)
}
specify
{
expect
(
described_class
).
to
require_graphql_authorizations
(
:read_board
)
}
specify
{
expect
(
described_class
).
to
require_graphql_authorizations
(
:read_
issue_
board
)
}
it
'has specific fields'
do
expected_fields
=
%w[id name web_url web_path]
...
...
spec/models/user_spec.rb
View file @
1cca0e9c
...
...
@@ -1828,7 +1828,7 @@ RSpec.describe User do
end
describe
'.instance_access_request_approvers_to_be_notified'
do
let_it_be
(
:admin_list
)
{
create_list
(
:user
,
12
,
:admin
,
:with_sign_ins
)
}
let_it_be
(
:admin_
issue_board_
list
)
{
create_list
(
:user
,
12
,
:admin
,
:with_sign_ins
)
}
it
'returns up to the ten most recently active instance admins'
do
active_admins_in_recent_sign_in_desc_order
=
User
.
admins
.
active
.
order_recent_sign_in
.
limit
(
10
)
...
...
spec/policies/project_policy_spec.rb
View file @
1cca0e9c
...
...
@@ -64,8 +64,8 @@ RSpec.describe ProjectPolicy do
end
it
'disables boards and lists permissions'
do
expect_disallowed
:read_board
,
:create_board
,
:update_board
expect_disallowed
:read_
list
,
:create_list
,
:update_list
,
:admin
_list
expect_disallowed
:read_
issue_
board
,
:create_board
,
:update_board
expect_disallowed
:read_
issue_board_list
,
:create_list
,
:update_list
,
:admin_issue_board
_list
end
context
'when external tracker configured'
do
...
...
spec/support/shared_contexts/policies/group_policy_shared_context.rb
View file @
1cca0e9c
...
...
@@ -18,12 +18,12 @@ RSpec.shared_context 'GroupPolicy context' do
]
end
let
(
:read_group_permissions
)
{
%i[read_label read_
list read_milestone read
_board]
}
let
(
:read_group_permissions
)
{
%i[read_label read_
issue_board_list read_milestone read_issue
_board]
}
let
(
:reporter_permissions
)
do
%i[
admin_label
admin_board
admin_
issue_
board
read_container_image
read_metrics_dashboard_annotation
read_prometheus
...
...
spec/support/shared_contexts/policies/project_policy_shared_context.rb
View file @
1cca0e9c
...
...
@@ -16,8 +16,8 @@ RSpec.shared_context 'ProjectPolicy context' do
let
(
:base_guest_permissions
)
do
%i[
award_emoji create_issue create_merge_request_in create_note
create_project read_board read_issue read_issue_iid read_issue_link
read_label read_list read_milestone read_note read_project
create_project read_
issue_
board read_issue read_issue_iid read_issue_link
read_label read_
issue_board_
list read_milestone read_note read_project
read_project_for_iids read_project_member read_release read_snippet
read_wiki upload_file
]
...
...
@@ -25,7 +25,7 @@ RSpec.shared_context 'ProjectPolicy context' do
let
(
:base_reporter_permissions
)
do
%i[
admin_issue admin_issue_link admin_label admin_list create_snippet
admin_issue admin_issue_link admin_label admin_
issue_board_
list create_snippet
download_code download_wiki_code fork_project metrics_dashboard
read_build read_commit_status read_confidential_issues
read_container_image read_deployment read_environment read_merge_request
...
...
spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb
View file @
1cca0e9c
...
...
@@ -25,7 +25,7 @@ RSpec.shared_examples 'group and project boards query' do
board
=
create
(
:board
,
resource_parent:
board_parent
,
name:
'A'
)
allow
(
Ability
).
to
receive
(
:allowed?
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_board
,
board
).
and_return
(
false
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_
issue_
board
,
board
).
and_return
(
false
)
post_graphql
(
query
,
current_user:
current_user
)
...
...
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