ssh_access_spec.rb revision 775a1be9b58fbbbd15522fa0723d7b7b43c9bc8a
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenrequire 'spec_helper'
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen let(:permission) { create :permission, role: 'reader' }
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen it 'should allow read on public readable repository' do
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen access = described_class.determine_permission('read', nil, repository)
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen it 'should disallow write on public readable repository' do
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen access = described_class.determine_permission('write', nil, repository)
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen it 'should allow read on public read-writeable repository' do
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen access = described_class.determine_permission('read', nil, repository)
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen it 'should allow write on public read-writeable repository' do
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen access = described_class.determine_permission('write', nil, repository)
8fcff4c5b52f24d9c681805fdf06b486f1d0fcbeTimo Sirainen it 'should disallow read on private readable repository' do
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen access = described_class.determine_permission('read', nil, repository)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen it 'should disallow write on private readable repository' do
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen access = described_class.determine_permission('write', nil, repository)
022412398e56a8f31ef111cfd7271498d64af9a9Timo Sirainen it 'should disallow read on private read-writeable repository' do
8fcff4c5b52f24d9c681805fdf06b486f1d0fcbeTimo Sirainen access = described_class.determine_permission('read', nil, repository)
e06c0b65c16ccce69bbee009ead14d7d3d17a256Timo Sirainen it 'should disallow write on private read-writeable repository' do
e05ea8311ae16687295048e88ca205dfe29fbcbfTimo Sirainen access = described_class.determine_permission('write', nil, repository)
98c1cf256927e254f0c092acd2ddcd7ea50bd009Timo Sirainen it 'should raise error on write to mirror repository' do
f7d43647acc6dc80064c8c4cacf5bf86f754c530Timo Sirainen repository.source_address = 'http://some_source_address.example.com'
98c1cf256927e254f0c092acd2ddcd7ea50bd009Timo Sirainen expect { described_class.determine_permission('write', nil, repository) }.
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen let(:permission) { create :permission, role: 'owner' }
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen it 'should allow write on public readable repository' do
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen access = described_class.determine_permission('write', permission, repository)
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen it 'should allow write on private readable repository' do
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen access = described_class.determine_permission('write', permission, repository)
02b79f9c2636da1829eee5b92753602bba8b67edTimo Sirainen it 'should raise error on write to mirror repository' do
02b79f9c2636da1829eee5b92753602bba8b67edTimo Sirainen repository.source_address = 'http://some_source_address.example.com'
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen expect { described_class.determine_permission('write', permission, repository) }.
02b79f9c2636da1829eee5b92753602bba8b67edTimo Sirainen let(:permission) { create :permission, role: 'editor' }
02b79f9c2636da1829eee5b92753602bba8b67edTimo Sirainen it 'should allow write on public readable repository' do
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen access = described_class.determine_permission('write', permission, repository)
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen it 'should allow write on private readable repository' do
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen access = described_class.determine_permission('write', permission, repository)
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen it 'should raise error on write to mirror repository' do
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen repository.source_address = 'http://some_source_address.example.com'
6288d3611eda14a017dae9927b73f46afb646c96Timo Sirainen expect { described_class.determine_permission('write', permission, repository) }.
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen it 'should allow read on public readable repository' do
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen access = described_class.determine_permission('read', permission, repository)
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen it 'should disallow write on public readable repository' do
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen access = described_class.determine_permission('write', permission, repository)
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen it 'should allow read on public read-writeable repository' do
dda2c506c8fc8ac2f88272de4523ded42baa0aa0Timo Sirainen access = described_class.determine_permission('read', permission, repository)
dda2c506c8fc8ac2f88272de4523ded42baa0aa0Timo Sirainen it 'should allow write on public read-writeable repository' do
dda2c506c8fc8ac2f88272de4523ded42baa0aa0Timo Sirainen access = described_class.determine_permission('write', permission, repository)
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen it 'should allow read on private readable repository' do
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen access = described_class.determine_permission('read', permission, repository)
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen it 'should disallow write on private readable repository' do
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen access = described_class.determine_permission('write', permission, repository)
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen it 'should allow read on private read-writeable repository' do
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen access = described_class.determine_permission('read', permission, repository)
1e76a5b92f9d82d557f81f080f3dfad1c9d8f200Timo Sirainen it 'should allow write on private read-writeable repository' do
b5e6f6f27c1461f0f9f202615eeb738a645188c3Timo Sirainen access = described_class.determine_permission('write', permission, repository)
e8a35266a5ceacdfafeeffd6bddae77931ff97ebTimo Sirainen it 'should raise error on write to mirror repository' do
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainen repository.source_address = 'http://some_source_address.example.com'