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
7af1bc3b
Commit
7af1bc3b
authored
Oct 09, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/api_remove_project' of /home/git/repositories/gitlab/gitlabhq
parents
551fa4c9
51825e43
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
1 deletion
+60
-1
doc/api/projects.md
doc/api/projects.md
+12
-0
lib/api/groups.rb
lib/api/groups.rb
+0
-1
lib/api/projects.rb
lib/api/projects.rb
+10
-0
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+38
-0
No files found.
doc/api/projects.md
View file @
7af1bc3b
...
...
@@ -244,6 +244,18 @@ Parameters:
+
`public`
(optional)
## Remove project
Removes project with all resources(issues, merge requests etc)
```
DELETE /projects/:id
```
Parameters:
+
`id`
(required) - The ID of a project
## Team members
...
...
lib/api/groups.rb
View file @
7af1bc3b
...
...
@@ -66,7 +66,6 @@ module API
present
group
,
with:
Entities
::
GroupDetail
end
# Remove group
#
# Parameters:
...
...
lib/api/projects.rb
View file @
7af1bc3b
...
...
@@ -129,6 +129,16 @@ module API
end
end
# Remove project
#
# Parameters:
# id (required) - The ID of a project
# Example Request:
# DELETE /projects/:id
delete
":id"
do
authorize!
:remove_project
,
user_project
user_project
.
destroy
end
# Mark this project as forked from another
#
...
...
spec/requests/api/projects_spec.rb
View file @
7af1bc3b
...
...
@@ -730,4 +730,42 @@ describe API::API do
end
end
end
describe
"DELETE /projects/:id"
do
context
"when authenticated as user"
do
it
"should remove project"
do
delete
api
(
"/projects/
#{
project
.
id
}
"
,
user
)
response
.
status
.
should
==
200
end
it
"should not remove a project if not an owner"
do
user3
=
create
(
:user
)
project
.
team
<<
[
user3
,
:developer
]
delete
api
(
"/projects/
#{
project
.
id
}
"
,
user3
)
response
.
status
.
should
==
403
end
it
"should not remove a non existing project"
do
delete
api
(
"/projects/1328"
,
user
)
response
.
status
.
should
==
404
end
it
"should not remove a project not attached to user"
do
delete
api
(
"/projects/
#{
project
.
id
}
"
,
user2
)
response
.
status
.
should
==
404
end
end
context
"when authenticated as admin"
do
it
"should remove any existing project"
do
delete
api
(
"/projects/
#{
project
.
id
}
"
,
admin
)
response
.
status
.
should
==
200
end
it
"should not remove a non existing project"
do
delete
api
(
"/projects/1328"
,
admin
)
response
.
status
.
should
==
404
end
end
end
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