Merge branch 'master' into cd-v3-parity
This commit is contained in:
commit
8057dc7ab9
|
@ -56,7 +56,7 @@ module Travis::API::V3
|
||||||
end
|
end
|
||||||
|
|
||||||
def organization_visible?(organization)
|
def organization_visible?(organization)
|
||||||
unrestricted_api?
|
full_access? or public_api?
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_visible?(user)
|
def user_visible?(user)
|
||||||
|
|
|
@ -25,6 +25,10 @@ module Travis::API::V3
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
def organization_visible?(organization)
|
||||||
|
super or organization_writable?(organization)
|
||||||
|
end
|
||||||
|
|
||||||
def organization_writable?(organization)
|
def organization_writable?(organization)
|
||||||
organization.members.include? user
|
organization.members.include? user
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,4 +19,17 @@ describe Travis::API::V3::Services::Organization::Find do
|
||||||
"avatar_url" => nil
|
"avatar_url" => nil
|
||||||
}}
|
}}
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user