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
Jérome Perrin
gitlab-ce
Commits
3bb8c17c
Commit
3bb8c17c
authored
Apr 23, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/gitlabhq/gitlabhq
parents
7fab63b4
2876f5d5
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
155 additions
and
62 deletions
+155
-62
CONTRIBUTING.md
CONTRIBUTING.md
+7
-6
app/assets/stylesheets/application.scss
app/assets/stylesheets/application.scss
+5
-50
config/gitlab.yml.example
config/gitlab.yml.example
+5
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+1
-1
doc/api/merge_requests.md
doc/api/merge_requests.md
+5
-4
doc/api/users.md
doc/api/users.md
+27
-0
doc/update/upgrader.md
doc/update/upgrader.md
+5
-1
lib/api/users.rb
lib/api/users.rb
+39
-0
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+61
-0
No files found.
CONTRIBUTING.md
View file @
3bb8c17c
...
...
@@ -107,9 +107,10 @@ For examples of feedback on merge requests please look at already [closed merge
## Style guides
1.
[
Ruby
](
https://github.com/bbatsov/ruby-style-guide
)
2.
[
Rails
](
https://github.com/bbatsov/rails-style-guide
)
3.
[
Formatting
](
https://github.com/thoughtbot/guides/tree/master/style#formatting
)
4.
[
Naming
](
https://github.com/thoughtbot/guides/tree/master/style#naming
)
8.
[
Testing
](
https://github.com/thoughtbot/guides/tree/master/style#testing
)
7.
[
CoffeeScript
](
https://github.com/thoughtbot/guides/tree/master/style#coffeescript
)
9.
[
Shell commands
](
doc/development/shell_commands.md
)
1.
[
Rails
](
https://github.com/bbatsov/rails-style-guide
)
1.
[
Formatting
](
https://github.com/thoughtbot/guides/tree/master/style#formatting
)
1.
[
Naming
](
https://github.com/thoughtbot/guides/tree/master/style#naming
)
1.
[
Testing
](
https://github.com/thoughtbot/guides/tree/master/style#testing
)
1.
[
CoffeeScript
](
https://github.com/thoughtbot/guides/tree/master/style#coffeescript
)
1.
[
Shell commands
](
doc/development/shell_commands.md
)
1.
[
Markdown
](
http://www.cirosantilli.com/markdown-styleguide
)
app/assets/stylesheets/application.scss
View file @
3bb8c17c
...
...
@@ -12,10 +12,7 @@
*= require nprogress-bootstrap
*/
@import
"main/variables.scss"
;
@import
"main/mixins.scss"
;
@import
"main/fonts.scss"
;
@import
"main/layout.scss"
;
@import
"main/*"
;
/**
* Customized Twitter bootstrap
...
...
@@ -31,64 +28,22 @@
/**
* Generic css (forms, nav etc):
*/
@import
"generic/avatar.scss"
;
@import
"generic/common.scss"
;
@import
"generic/typography.scss"
;
@import
"generic/buttons.scss"
;
@import
"generic/blocks.scss"
;
@import
"generic/ui_box.scss"
;
@import
"generic/issue_box.scss"
;
@import
"generic/files.scss"
;
@import
"generic/lists.scss"
;
@import
"generic/flash.scss"
;
@import
"generic/forms.scss"
;
@import
"generic/selects.scss"
;
@import
"generic/highlight.scss"
;
@import
"generic/jquery.scss"
;
@import
"generic/*"
;
/**
* Page specific styles (issues, projects etc):
*/
@import
"sections/header.scss"
;
@import
"sections/nav.scss"
;
@import
"sections/commits.scss"
;
@import
"sections/diff.scss"
;
@import
"sections/issues.scss"
;
@import
"sections/projects.scss"
;
@import
"sections/snippets.scss"
;
@import
"sections/votes.scss"
;
@import
"sections/merge_requests.scss"
;
@import
"sections/graph.scss"
;
@import
"sections/events.scss"
;
@import
"sections/themes.scss"
;
@import
"sections/tree.scss"
;
@import
"sections/notes.scss"
;
@import
"sections/profile.scss"
;
@import
"sections/login.scss"
;
@import
"sections/editor.scss"
;
@import
"sections/admin.scss"
;
@import
"sections/wiki.scss"
;
@import
"sections/wall.scss"
;
@import
"sections/dashboard.scss"
;
@import
"sections/stat_graph.scss"
;
@import
"sections/groups.scss"
;
@import
"sections/*"
;
/**
* Code highlight
*/
@import
"highlight/white.scss"
;
@import
"highlight/dark.scss"
;
@import
"highlight/solarized_dark.scss"
;
@import
"highlight/monokai.scss"
;
@import
"highlight/*"
;
/**
* UI themes:
*/
@import
"themes/ui_basic.scss"
;
@import
"themes/ui_mars.scss"
;
@import
"themes/ui_modern.scss"
;
@import
"themes/ui_gray.scss"
;
@import
"themes/ui_color.scss"
;
@import
"themes/*"
;
/**
* Styles for JS behaviors.
...
...
config/gitlab.yml.example
View file @
3bb8c17c
...
...
@@ -19,6 +19,11 @@ production: &base
port: 80
https: false
# Uncommment this line below if your ssh host is different from HTTP/HTTPS one
# (you'd obviously need to replace ssh.host_example.com with your own host).
# Otherwise, ssh host will be set to the `host:` value above
# ssh_host: ssh.host_example.com
# Uncomment and customize the last line to run in a non-root path
# WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this.
# Note that four settings need to be changed for this to work.
...
...
config/initializers/1_settings.rb
View file @
3bb8c17c
...
...
@@ -117,7 +117,7 @@ Settings.gitlab_shell['hooks_path'] ||= Settings.gitlab['user_home'] + '/gitla
Settings
.
gitlab_shell
[
'receive_pack'
]
=
true
if
Settings
.
gitlab_shell
[
'receive_pack'
].
nil?
Settings
.
gitlab_shell
[
'upload_pack'
]
=
true
if
Settings
.
gitlab_shell
[
'upload_pack'
].
nil?
Settings
.
gitlab_shell
[
'repos_path'
]
||=
Settings
.
gitlab
[
'user_home'
]
+
'/repositories/'
Settings
.
gitlab_shell
[
'ssh_host'
]
||=
(
Settings
.
gitlab
.
host
||
'localhost'
)
Settings
.
gitlab_shell
[
'ssh_host'
]
||=
(
Settings
.
gitlab
.
ssh_host
||
Settings
.
gitlab
.
host
||
'localhost'
)
Settings
.
gitlab_shell
[
'ssh_port'
]
||=
22
Settings
.
gitlab_shell
[
'ssh_user'
]
||=
Settings
.
gitlab
.
user
Settings
.
gitlab_shell
[
'owner_group'
]
||=
Settings
.
gitlab
.
user
...
...
doc/api/merge_requests.md
View file @
3bb8c17c
...
...
@@ -109,6 +109,7 @@ Parameters:
+
`target_branch`
(required) - The target branch
+
`assignee_id`
(optional) - Assignee user ID
+
`title`
(required) - Title of MR
+
`target_project_id`
(optional) - The target project (numeric id)
```
json
{
...
...
doc/api/users.md
View file @
3bb8c17c
...
...
@@ -220,6 +220,18 @@ Parameters:
+
**none**
## List SSH keys for user
Get a list of a specified user's SSH keys. Available only for admin
```
GET /users/:uid/keys
```
Parameters:
+
`uid`
(required) - id of specified user
## Single SSH key
...
...
@@ -286,3 +298,18 @@ Parameters:
+
`id`
(required) - SSH key ID
## Delete SSH key
Deletes key owned by a specified user. Available only for admin.
```
DELETE /users/:uid/keys/:id
```
Parameters:
+
`uid`
(required) - id of specified user
+
`id`
(required) - SSH key ID
Will return
`200 Ok`
on success, or
`404 Not found`
if either user or key cannot be found.
doc/update/upgrader.md
View file @
3bb8c17c
...
...
@@ -46,4 +46,8 @@ If all items are green, then congratulations upgrade is complete!
You've read through the entire guide, and probably did all the steps manually. Here is a one liner for convenience, the next time you upgrade:
cd /home/git/gitlab; sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production; sudo service gitlab stop; sudo -u git -H ruby script/upgrade.rb -y; sudo service gitlab start; sudo service nginx restart; sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
```
bash
cd
/home/git/gitlab
;
sudo
-u
git
-H
bundle
exec
rake gitlab:backup:create
RAILS_ENV
=
production
;
\
sudo
service gitlab stop
;
sudo
-u
git
-H
ruby script/upgrade.rb
-y
;
sudo
service gitlab start
;
\
sudo
service nginx restart
;
sudo
-u
git
-H
bundle
exec
rake gitlab:check
RAILS_ENV
=
production
```
lib/api/users.rb
View file @
3bb8c17c
...
...
@@ -113,6 +113,45 @@ module API
end
end
# Get ssh keys of a specified user. Only available to admin users.
#
# Parameters:
# uid (required) - The ID of a user
# Example Request:
# GET /users/:uid/keys
get
':uid/keys'
do
authenticated_as_admin!
user
=
User
.
find_by
(
id:
params
[
:uid
])
if
user
present
user
.
keys
,
with:
Entities
::
SSHKey
else
not_found!
end
end
# Delete existing ssh key of a specified user. Only available to admin
# users.
#
# Parameters:
# uid (required) - The ID of a user
# id (required) - SSH Key ID
# Example Request:
# DELETE /users/:uid/keys/:id
delete
':uid/keys/:id'
do
authenticated_as_admin!
user
=
User
.
find_by
(
id:
params
[
:uid
])
if
user
begin
key
=
user
.
keys
.
find
params
[
:id
]
key
.
destroy
rescue
ActiveRecord
::
RecordNotFound
not_found!
end
else
not_found!
end
end
# Delete user. Available only for admin
#
# Example Request:
...
...
spec/requests/api/users_spec.rb
View file @
3bb8c17c
...
...
@@ -242,6 +242,67 @@ describe API::API, api: true do
end
end
describe
'GET /user/:uid/keys'
do
before
{
admin
}
context
'when unauthenticated'
do
it
'should return authentication error'
do
get
api
(
"/users/
#{
user
.
id
}
/keys"
)
response
.
status
.
should
==
401
end
end
context
'when authenticated'
do
it
'should return 404 for non-existing user'
do
get
api
(
'/users/999999/keys'
,
admin
)
response
.
status
.
should
==
404
end
it
'should return array of ssh keys'
do
user
.
keys
<<
key
user
.
save
get
api
(
"/users/
#{
user
.
id
}
/keys"
,
admin
)
response
.
status
.
should
==
200
json_response
.
should
be_an
Array
json_response
.
first
[
'title'
].
should
==
key
.
title
end
end
end
describe
'DELETE /user/:uid/keys/:id'
do
before
{
admin
}
context
'when unauthenticated'
do
it
'should return authentication error'
do
delete
api
(
"/users/
#{
user
.
id
}
/keys/42"
)
response
.
status
.
should
==
401
end
end
context
'when authenticated'
do
it
'should delete existing key'
do
user
.
keys
<<
key
user
.
save
expect
{
delete
api
(
"/users/
#{
user
.
id
}
/keys/
#{
key
.
id
}
"
,
admin
)
}.
to
change
{
user
.
keys
.
count
}.
by
(
-
1
)
response
.
status
.
should
==
200
end
it
'should return 404 error if user not found'
do
user
.
keys
<<
key
user
.
save
delete
api
(
"/users/999999/keys/
#{
key
.
id
}
"
,
admin
)
response
.
status
.
should
==
404
end
it
'should return 404 error if key not foud'
do
delete
api
(
"/users/
#{
user
.
id
}
/keys/42"
,
admin
)
response
.
status
.
should
==
404
end
end
end
describe
"DELETE /users/:id"
do
before
{
admin
}
...
...
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