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
b4a74088
Commit
b4a74088
authored
Jul 27, 2020
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't expose epic for users without permissions
- epic is not required field anymore
parent
2b6d2bdd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
4 deletions
+70
-4
ee/app/serializers/ee/issue_sidebar_extras_entity.rb
ee/app/serializers/ee/issue_sidebar_extras_entity.rb
+5
-1
ee/changelogs/unreleased/security-conf-epic-visibility.yml
ee/changelogs/unreleased/security-conf-epic-visibility.yml
+5
-0
ee/spec/fixtures/api/schemas/entities/issue_sidebar_extras.json
...c/fixtures/api/schemas/entities/issue_sidebar_extras.json
+0
-1
ee/spec/serializers/ee/issue_sidebar_extras_entity_spec.rb
ee/spec/serializers/ee/issue_sidebar_extras_entity_spec.rb
+53
-0
ee/spec/serializers/issue_serializer_spec.rb
ee/spec/serializers/issue_serializer_spec.rb
+7
-2
No files found.
ee/app/serializers/ee/issue_sidebar_extras_entity.rb
View file @
b4a74088
...
@@ -5,13 +5,17 @@ module EE
...
@@ -5,13 +5,17 @@ module EE
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
prepended
do
prepended
do
expose
:epic
do
expose
:epic
,
if:
->
(
issuable
,
_
)
{
cen_read_epic?
(
issuable
)
}
do
expose
:epic
,
merge:
true
,
using:
EpicBaseEntity
expose
:epic
,
merge:
true
,
using:
EpicBaseEntity
expose
:epic_issue_id
do
|
issuable
|
expose
:epic_issue_id
do
|
issuable
|
issuable
.
epic_issue
&
.
id
issuable
.
epic_issue
&
.
id
end
end
end
end
expose
:weight
expose
:weight
def
cen_read_epic?
(
issuable
)
can?
(
request
.
current_user
,
:read_epic
,
issuable
.
epic
)
end
end
end
end
end
end
end
ee/changelogs/unreleased/security-conf-epic-visibility.yml
0 → 100644
View file @
b4a74088
---
title
:
Fix displaying epics visibility in issue sidebar
merge_request
:
author
:
type
:
security
ee/spec/fixtures/api/schemas/entities/issue_sidebar_extras.json
View file @
b4a74088
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
"weight"
:
{
"type"
:
[
"integer"
,
"null"
]
}
"weight"
:
{
"type"
:
[
"integer"
,
"null"
]
}
},
},
"required"
:
[
"required"
:
[
"epic"
,
"weight"
"weight"
]
]
}
}
...
...
ee/spec/serializers/ee/issue_sidebar_extras_entity_spec.rb
0 → 100644
View file @
b4a74088
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
IssueSidebarExtrasEntity
do
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
group:
group
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:issue
,
reload:
true
)
{
create
(
:issue
,
:confidential
,
project:
project
)
}
let
(
:request
)
{
double
(
'request'
,
current_user:
user
)
}
subject
{
described_class
.
new
(
issue
,
request:
request
).
as_json
}
context
'exposing epic'
do
before
do
stub_licensed_features
(
epics:
true
)
end
context
'when epic is confidential'
do
let_it_be
(
:confidential_epic
)
{
create
(
:epic
,
:confidential
,
group:
group
)
}
let_it_be
(
:epic_issue
)
{
create
(
:epic_issue
,
issue:
issue
,
epic:
confidential_epic
)
}
it
'returns nil for a user who is a project member'
do
project
.
add_developer
(
user
)
expect
(
subject
[
:epic
]).
to
be_nil
end
it
'exposes the epic for a user who is a group member'
do
group
.
add_developer
(
user
)
expect
(
subject
[
:epic
].
keys
).
to
match_array
([
:id
,
:iid
,
:title
,
:url
,
:group_id
,
:epic_issue_id
])
end
end
context
'when epic is not confidential'
do
let_it_be
(
:epic
)
{
create
(
:epic
,
group:
group
)
}
let_it_be
(
:epic_issue
)
{
create
(
:epic_issue
,
issue:
issue
,
epic:
epic
)
}
it
'exposes the epic for a project member'
do
project
.
add_developer
(
user
)
expect
(
subject
[
:epic
].
keys
).
to
match_array
([
:id
,
:iid
,
:title
,
:url
,
:group_id
,
:epic_issue_id
])
end
it
'exposes the epic for a user who is a group member'
do
group
.
add_developer
(
user
)
expect
(
subject
[
:epic
].
keys
).
to
match_array
([
:id
,
:iid
,
:title
,
:url
,
:group_id
,
:epic_issue_id
])
end
end
end
end
ee/spec/serializers/issue_serializer_spec.rb
View file @
b4a74088
...
@@ -12,8 +12,13 @@ RSpec.describe IssueSerializer do
...
@@ -12,8 +12,13 @@ RSpec.describe IssueSerializer do
end
end
before
do
before
do
epic
=
create
(
:epic
,
:use_fixed_dates
)
stub_licensed_features
(
epics:
true
)
create
(
:epic_issue
,
issue:
resource
,
epic:
epic
)
create
(
:epic
,
:use_fixed_dates
).
tap
do
|
epic
|
create
(
:epic_issue
,
issue:
resource
,
epic:
epic
)
end
resource
.
reload
end
end
context
'sidebar issue serialization'
do
context
'sidebar issue serialization'
do
...
...
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