Merge branch 'master' into cd-v3-parity

This commit is contained in:
carlad 2015-08-21 17:07:25 +02:00
commit 8057dc7ab9
3 changed files with 18 additions and 1 deletions

View File

@ -56,7 +56,7 @@ module Travis::API::V3
end
def organization_visible?(organization)
unrestricted_api?
full_access? or public_api?
end
def user_visible?(user)

View File

@ -25,6 +25,10 @@ module Travis::API::V3
protected
def organization_visible?(organization)
super or organization_writable?(organization)
end
def organization_writable?(organization)
organization.members.include? user
end

View File

@ -19,4 +19,17 @@ describe Travis::API::V3::Services::Organization::Find do
"avatar_url" => nil
}}
end
describe 'existing org, private api' do
before { Travis.config.private_api = true }
before { get("/v3/org/#{org.id}") }
after { Travis.config.private_api = false }
example { expect(last_response).to be_not_found }
example { expect(JSON.load(body)).to be == {
"@type" => "error",
"error_type" => "not_found",
"error_message" =>"organization not found (or insufficient access)",
"resource_type" => "organization"
}}
end
end