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
b847affa
Commit
b847affa
authored
Jun 30, 2020
by
Jason Goodman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve permissions checks for feature flag issue links
Use Ability interface
parent
cd9838f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
ee/app/services/feature_flag_issues/create_service.rb
ee/app/services/feature_flag_issues/create_service.rb
+1
-1
ee/spec/controllers/projects/feature_flag_issues_controller_spec.rb
...ntrollers/projects/feature_flag_issues_controller_spec.rb
+2
-2
No files found.
ee/app/services/feature_flag_issues/create_service.rb
View file @
b847affa
...
@@ -7,7 +7,7 @@ module FeatureFlagIssues
...
@@ -7,7 +7,7 @@ module FeatureFlagIssues
end
end
def
linkable_issuables
(
issues
)
def
linkable_issuables
(
issues
)
issues
.
select
{
|
issue
|
can?
(
current_user
,
:read_issue
,
issue
)
}
Ability
.
issues_readable_by_user
(
issues
,
current_user
)
end
end
def
relate_issuables
(
referenced_issue
)
def
relate_issuables
(
referenced_issue
)
...
...
ee/spec/controllers/projects/feature_flag_issues_controller_spec.rb
View file @
b847affa
...
@@ -323,8 +323,8 @@ RSpec.describe Projects::FeatureFlagIssuesController do
...
@@ -323,8 +323,8 @@ RSpec.describe Projects::FeatureFlagIssuesController do
it
'does not create a link when the user cannot read the issue'
do
it
'does not create a link when the user cannot read the issue'
do
feature_flag
,
issue
=
setup
feature_flag
,
issue
=
setup
sign_in
(
developer
)
sign_in
(
developer
)
allow
(
Ability
).
to
receive
(
:
allowed?
).
and_call_original
allow
(
Ability
).
to
receive
(
:
issues_readable_by_user
).
and_call_original
allow
(
Ability
).
to
receive
(
:
allowed?
).
with
(
developer
,
:read_issue
,
issue
).
and_return
(
false
)
allow
(
Ability
).
to
receive
(
:
issues_readable_by_user
).
with
([
issue
],
developer
).
and_return
([]
)
post_request
(
project
,
feature_flag
,
issue
)
post_request
(
project
,
feature_flag
,
issue
)
...
...
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