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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
6f894bec
Commit
6f894bec
authored
Mar 24, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add definition of before action that has been moved
Closes #14528
parent
63c8a05b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
CHANGELOG
CHANGELOG
+1
-0
app/controllers/ci/projects_controller.rb
app/controllers/ci/projects_controller.rb
+5
-1
spec/controllers/ci/projects_controller_spec.rb
spec/controllers/ci/projects_controller_spec.rb
+10
-0
No files found.
CHANGELOG
View file @
6f894bec
...
...
@@ -7,6 +7,7 @@ v 8.7.0 (unreleased)
v 8.6.2 (unreleased)
- Comments on confidential issues don't show up in activity feed to non-members
- Fix NoMethodError when visiting CI root path at `/ci`
v 8.6.1
- Add option to reload the schema before restoring a database backup. !2807
...
...
app/controllers/ci/projects_controller.rb
View file @
6f894bec
module
Ci
class
ProjectsController
<
Ci
::
ApplicationController
before_action
:project
before_action
:authorize_read_project!
,
except:
[
:badge
]
before_action
:no_cache
,
only:
[
:badge
]
before_action
:authorize_read_project!
,
except:
[
:badge
,
:index
]
skip_before_action
:authenticate_user!
,
only:
[
:badge
]
protect_from_forgery
...
...
@@ -35,5 +35,9 @@ module Ci
response
.
headers
[
"Pragma"
]
=
"no-cache"
response
.
headers
[
"Expires"
]
=
"Fri, 01 Jan 1990 00:00:00 GMT"
end
def
authorize_read_project!
return
access_denied!
unless
can?
(
current_user
,
:read_project
,
project
)
end
end
end
spec/controllers/ci/projects_controller_spec.rb
View file @
6f894bec
...
...
@@ -5,6 +5,16 @@ describe Ci::ProjectsController do
let!
(
:project
)
{
create
(
:project
,
visibility
,
ci_id:
1
)
}
let
(
:ci_id
)
{
project
.
ci_id
}
describe
'#index'
do
let
(
:user
)
{
create
(
:user
)
}
before
{
sign_in
(
user
)
}
before
{
get
(
:index
)
}
it
'returns 200'
do
expect
(
response
.
status
).
to
eq
200
end
end
##
# Specs for *deprecated* CI badge
#
...
...
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