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
Kazuhiko Shiozaki
gitlab-ce
Commits
a767c133
Commit
a767c133
authored
Dec 05, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5752 from jhollingsworth/fix/no-404-for-project
Fix 404 on project page for unauthenticated user
parents
e5f4c788
c099074f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
71 additions
and
6 deletions
+71
-6
CHANGELOG
CHANGELOG
+1
-0
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+3
-0
features/project/redirects.feature
features/project/redirects.feature
+26
-0
features/public/public_projects.feature
features/public/public_projects.feature
+2
-2
features/steps/profile/profile.rb
features/steps/profile/profile.rb
+0
-4
features/steps/project/redirects.rb
features/steps/project/redirects.rb
+35
-0
features/steps/shared/authentication.rb
features/steps/shared/authentication.rb
+4
-0
No files found.
CHANGELOG
View file @
a767c133
...
...
@@ -8,6 +8,7 @@ v 6.4.0
- Internal projects (Jason Hollingsworth)
- Allow removal of avatar (Drew Blessing)
- Project web hooks now support issues and merge request events
- Visiting project page while not logged in will redirect to sign-in instead of 404 (Jason Hollingsworth)
v 6.3.0
- API for adding gitlab-ci service
...
...
app/controllers/application_controller.rb
View file @
a767c133
...
...
@@ -81,6 +81,9 @@ class ApplicationController < ActionController::Base
if
@project
and
can?
(
current_user
,
:read_project
,
@project
)
@project
elsif
current_user
.
nil?
@project
=
nil
authenticate_user!
else
@project
=
nil
render_404
and
return
...
...
features/project/redirects.feature
0 → 100644
View file @
a767c133
Feature
:
Project Redirects
Background
:
Given
public project
"Community"
And
private project
"Enterprise"
Scenario
:
I
visit public project page
When
I visit project
"Community"
page
Then
I should see project
"Community"
home page
Scenario
:
I
visit private project page
When
I visit project
"Enterprise"
page
Then
I should be redirected to sign in page
Scenario
:
I
visit a non-existent project page
When
I visit project
"CommunityDoesNotExist"
page
Then
I should be redirected to sign in page
Scenario
:
I
visit a non-existent project page as user
Given
I sign in as a user
When
I visit project
"CommunityDoesNotExist"
page
Then
page status code should be 404
Scenario
:
I
visit unauthorized project page as user
Given
I sign in as a user
When
I visit project
"Enterprise"
page
Then
page status code should be 404
features/public/public_projects.feature
View file @
a767c133
...
...
@@ -16,11 +16,11 @@ Feature: Public Projects Feature
Scenario
:
I
visit internal project page
When
I visit project
"Internal"
page
Then
page status code should be 404
Then
I should be redirected to sign in page
Scenario
:
I
visit private project page
When
I visit project
"Enterprise"
page
Then
page status code should be 404
Then
I should be redirected to sign in page
Scenario
:
I
visit an empty public project page
Given
public empty project
"Empty Public Project"
...
...
features/steps/profile/profile.rb
View file @
a767c133
...
...
@@ -88,10 +88,6 @@ class Profile < Spinach::FeatureSteps
page
.
should
have_content
"Password doesn't match confirmation"
end
step
'I should be redirected to sign in page'
do
current_path
.
should
==
new_user_session_path
end
step
'I reset my token'
do
within
'.update-token'
do
@old_token
=
@user
.
private_token
...
...
features/steps/project/redirects.rb
0 → 100644
View file @
a767c133
class
Spinach::Features::ProjectRedirects
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
step
'public project "Community"'
do
create
:project_with_code
,
name:
'Community'
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
end
step
'private project "Enterprise"'
do
create
:project
,
name:
'Enterprise'
end
step
'I visit project "Community" page'
do
project
=
Project
.
find_by_name
(
'Community'
)
visit
project_path
(
project
)
end
step
'I should see project "Community" home page'
do
within
'.project-home-title'
do
page
.
should
have_content
'Community'
end
end
step
'I visit project "Enterprise" page'
do
project
=
Project
.
find_by_name
(
'Enterprise'
)
visit
project_path
(
project
)
end
step
'I visit project "CommunityDoesNotExist" page'
do
project
=
Project
.
find_by_name
(
'Community'
)
visit
project_path
(
project
)
+
'DoesNotExist'
end
end
features/steps/shared/authentication.rb
View file @
a767c133
...
...
@@ -12,6 +12,10 @@ module SharedAuthentication
login_as
:admin
end
step
'I should be redirected to sign in page'
do
current_path
.
should
==
new_user_session_path
end
def
current_user
@user
||
User
.
first
end
...
...
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