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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
4c6224aa
Commit
4c6224aa
authored
Jan 10, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Public git read-only access via http
parent
eb626edd
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
89 additions
and
15 deletions
+89
-15
app/controllers/public/projects_controller.rb
app/controllers/public/projects_controller.rb
+11
-0
app/models/project.rb
app/models/project.rb
+1
-1
app/views/admin/projects/_form.html.haml
app/views/admin/projects/_form.html.haml
+7
-0
app/views/admin/projects/show.html.haml
app/views/admin/projects/show.html.haml
+7
-0
app/views/layouts/public.html.haml
app/views/layouts/public.html.haml
+17
-0
app/views/public/projects/index.html.haml
app/views/public/projects/index.html.haml
+14
-0
config/routes.rb
config/routes.rb
+8
-0
db/migrate/20130110172407_add_public_to_project.rb
db/migrate/20130110172407_add_public_to_project.rb
+5
-0
db/schema.rb
db/schema.rb
+9
-8
lib/gitlab/backend/grack_auth.rb
lib/gitlab/backend/grack_auth.rb
+10
-6
No files found.
app/controllers/public/projects_controller.rb
0 → 100644
View file @
4c6224aa
class
Public::ProjectsController
<
ApplicationController
skip_before_filter
:authenticate_user!
,
:reject_blocked
,
:set_current_user_for_observers
,
:add_abilities
layout
'public'
def
index
@projects
=
Project
.
where
(
public:
true
)
end
end
app/models/project.rb
View file @
4c6224aa
...
...
@@ -28,7 +28,7 @@ class Project < ActiveRecord::Base
attr_accessible
:name
,
:path
,
:description
,
:default_branch
,
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
as:
[
:default
,
:admin
]
attr_accessible
:namespace_id
,
:creator_id
,
as: :admin
attr_accessible
:namespace_id
,
:creator_id
,
:public
,
as: :admin
attr_accessor
:error_code
...
...
app/views/admin/projects/_form.html.haml
View file @
4c6224aa
...
...
@@ -43,6 +43,13 @@
=
f
.
label
:wiki_enabled
,
"Wiki"
.input
=
f
.
check_box
:wiki_enabled
%fieldset
.features
%legend
Public mode:
.clearfix
=
f
.
label
:public
do
%span
Allow public http clone
.input
=
f
.
check_box
:public
%fieldset
.features
%legend
Transfer:
.control-group
...
...
app/views/admin/projects/show.html.haml
View file @
4c6224aa
...
...
@@ -77,6 +77,13 @@
SSH:
%td
=
link_to
@project
.
ssh_url_to_repo
-
if
@project
.
public
%tr
.bgred
%td
%b
Public Read-Only Code access:
%td
=
check_box_tag
'public'
,
nil
,
@project
.
public
-
if
@repository
%table
.zebra-striped
...
...
app/views/layouts/public.html.haml
0 → 100644
View file @
4c6224aa
!!! 5
%html
{
lang:
"en"
}
=
render
"layouts/head"
,
title:
"Error"
%body
{
class:
"#{app_theme} application"
}
%header
.navbar.navbar-static-top.navbar-gitlab
.navbar-inner
.container
%div
.app_logo
%span
.separator
=
link_to
public_root_path
,
class:
"home"
do
%h1
GITLAB
%span
.separator
%h1
.project_name
Public
.container
.content
.prepend-top-20
=
yield
app/views/public/projects/index.html.haml
0 → 100644
View file @
4c6224aa
%h3
.page_title
Projects
%small
Read-Only Access
%hr
%ul
.well-list
-
@projects
.
each
do
|
project
|
%li
.clearfix
%h5
%i
.icon-star.cgreen
=
project
.
name_with_namespace
.right
%span
.monospace.tiny
git clone
#{
project
.
http_url_to_repo
}
config/routes.rb
View file @
4c6224aa
...
...
@@ -36,6 +36,14 @@ Gitlab::Application.routes.draw do
get
'help/ssh'
=>
'help#ssh'
get
'help/raketasks'
=>
'help#raketasks'
#
# Public namespace
#
namespace
:public
do
resources
:projects
,
only:
[
:index
]
root
to:
"projects#index"
end
#
# Admin Area
#
...
...
db/migrate/20130110172407_add_public_to_project.rb
0 → 100644
View file @
4c6224aa
class
AddPublicToProject
<
ActiveRecord
::
Migration
def
change
add_column
:projects
,
:public
,
:boolean
,
default:
false
,
null:
false
end
end
db/schema.rb
View file @
4c6224aa
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
:version
=>
201301
02143055
)
do
ActiveRecord
::
Schema
.
define
(
:version
=>
201301
10172407
)
do
create_table
"events"
,
:force
=>
true
do
|
t
|
t
.
string
"target_type"
...
...
@@ -155,6 +155,7 @@ ActiveRecord::Schema.define(:version => 20130102143055) do
t
.
boolean
"merge_requests_enabled"
,
:default
=>
true
,
:null
=>
false
t
.
boolean
"wiki_enabled"
,
:default
=>
true
,
:null
=>
false
t
.
integer
"namespace_id"
t
.
boolean
"public"
,
:default
=>
false
,
:null
=>
false
end
add_index
"projects"
,
[
"creator_id"
],
:name
=>
"index_projects_on_owner_id"
...
...
lib/gitlab/backend/grack_auth.rb
View file @
4c6224aa
...
...
@@ -3,6 +3,16 @@ module Grack
attr_accessor
:user
,
:project
def
valid?
# Find project by PATH_INFO from env
if
m
=
/^\/([\w\.\/-]+)\.git/
.
match
(
@request
.
path_info
).
to_a
self
.
project
=
Project
.
find_with_namespace
(
m
.
last
)
return
false
unless
project
end
if
@request
.
get?
&&
project
.
public
return
true
end
# Authentication with username and password
login
,
password
=
@auth
.
credentials
...
...
@@ -17,12 +27,6 @@ module Grack
# Pass Gitolite update hook
ENV
[
'GL_BYPASS_UPDATE_HOOK'
]
=
"true"
# Find project by PATH_INFO from env
if
m
=
/^\/([\w\.\/-]+)\.git/
.
match
(
@request
.
path_info
).
to_a
self
.
project
=
Project
.
find_with_namespace
(
m
.
last
)
return
false
unless
project
end
# Git upload and receive
if
@request
.
get?
validate_get_request
...
...
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