show only current user projects
This commit is contained in:
parent
7b5c3cc8be
commit
84a3f8fca4
|
@ -41,19 +41,19 @@ module Gitlab
|
||||||
|
|
||||||
# GET /projects/:id
|
# GET /projects/:id
|
||||||
get ":id" do
|
get ":id" do
|
||||||
@project = Project.find_by_code(params[:id])
|
@project = current_user.projects.find_by_code(params[:id])
|
||||||
present @project, :with => Entities::Project
|
present @project, :with => Entities::Project
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /projects/:id/repository/branches
|
# GET /projects/:id/repository/branches
|
||||||
get ":id/repository/branches" do
|
get ":id/repository/branches" do
|
||||||
@project = Project.find_by_code(params[:id])
|
@project = current_user.projects.find_by_code(params[:id])
|
||||||
present @project.repo.heads.sort_by(&:name), :with => Entities::ProjectRepositoryBranches
|
present @project.repo.heads.sort_by(&:name), :with => Entities::ProjectRepositoryBranches
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /projects/:id/repository/tags
|
# GET /projects/:id/repository/tags
|
||||||
get ":id/repository/tags" do
|
get ":id/repository/tags" do
|
||||||
@project = Project.find_by_code(params[:id])
|
@project = current_user.projects.find_by_code(params[:id])
|
||||||
present @project.repo.tags.sort_by(&:name).reverse, :with => Entities::ProjectRepositoryTags
|
present @project.repo.tags.sort_by(&:name).reverse, :with => Entities::ProjectRepositoryTags
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,10 +3,9 @@ require 'spec_helper'
|
||||||
describe Gitlab::API do
|
describe Gitlab::API do
|
||||||
let(:user) { Factory :user }
|
let(:user) { Factory :user }
|
||||||
let!(:project) { Factory :project, :owner => user }
|
let!(:project) { Factory :project, :owner => user }
|
||||||
|
|
||||||
describe "GET /projects" do
|
|
||||||
before { project.add_access(user, :read) }
|
before { project.add_access(user, :read) }
|
||||||
|
|
||||||
|
describe "GET /projects" do
|
||||||
it "should return authentication error" do
|
it "should return authentication error" do
|
||||||
get "/api/projects"
|
get "/api/projects"
|
||||||
response.status.should == 401
|
response.status.should == 401
|
||||||
|
|
Loading…
Reference in New Issue