##// END OF EJS Templates
Merged r16286 (#24307)....
Jean-Philippe Lang -
r15915:83921f27d4af
parent child
Show More
@@ -244,6 +244,7 sub RedmineDSN {
244 WHERE
244 WHERE
245 users.login=?
245 users.login=?
246 AND projects.identifier=?
246 AND projects.identifier=?
247 AND EXISTS (SELECT 1 FROM enabled_modules em WHERE em.project_id = projects.id AND em.name = 'repository')
247 AND users.type='User'
248 AND users.type='User'
248 AND users.status=1
249 AND users.status=1
249 AND (
250 AND (
@@ -390,7 +391,9 sub is_public_project {
390
391
391 my $dbh = connect_database($r);
392 my $dbh = connect_database($r);
392 my $sth = $dbh->prepare(
393 my $sth = $dbh->prepare(
393 "SELECT is_public FROM projects WHERE projects.identifier = ? AND projects.status <> 9;"
394 "SELECT is_public FROM projects
395 WHERE projects.identifier = ? AND projects.status <> 9
396 AND EXISTS (SELECT 1 FROM enabled_modules em WHERE em.project_id = projects.id AND em.name = 'repository');"
394 );
397 );
395
398
396 $sth->execute($project_id);
399 $sth->execute($project_id);
@@ -19,7 +19,7 require File.expand_path('../test_case', __FILE__)
19 require 'tmpdir'
19 require 'tmpdir'
20
20
21 class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase
21 class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase
22 fixtures :projects, :users, :members, :roles, :member_roles, :auth_sources
22 fixtures :projects, :users, :members, :roles, :member_roles, :auth_sources, :enabled_modules
23
23
24 SVN_BIN = Redmine::Configuration['scm_subversion_command'] || "svn"
24 SVN_BIN = Redmine::Configuration['scm_subversion_command'] || "svn"
25
25
@@ -38,6 +38,11 class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase
38 assert_failure "ls", svn_url
38 assert_failure "ls", svn_url
39 end
39 end
40
40
41 def test_anonymous_read_on_public_project_with_module_disabled_should_fail
42 Project.find(1).disable_module! :repository
43 assert_failure "ls", svn_url
44 end
45
41 def test_anonymous_read_on_private_repo_should_fail
46 def test_anonymous_read_on_private_repo_should_fail
42 Project.find(1).update_attribute :is_public, false
47 Project.find(1).update_attribute :is_public, false
43 assert_failure "ls", svn_url
48 assert_failure "ls", svn_url
@@ -128,6 +133,15 class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase
128 end
133 end
129 end
134 end
130
135
136 def test_member_read_on_private_repo_with_module_disabled_should_fail
137 Role.find(2).add_permission! :browse_repository
138 Project.find(1).update_attribute :is_public, false
139 Project.find(1).disable_module! :repository
140 with_credentials "dlopper", "foo" do
141 assert_failure "ls", svn_url
142 end
143 end
144
131 def test_member_commit_on_public_repo_with_permission_should_succeed
145 def test_member_commit_on_public_repo_with_permission_should_succeed
132 Role.find(2).add_permission! :commit_access
146 Role.find(2).add_permission! :commit_access
133 with_credentials "dlopper", "foo" do
147 with_credentials "dlopper", "foo" do
@@ -158,6 +172,15 class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase
158 end
172 end
159 end
173 end
160
174
175 def test_member_commit_on_private_repo_with_module_disabled_should_fail
176 Role.find(2).add_permission! :commit_access
177 Project.find(1).update_attribute :is_public, false
178 Project.find(1).disable_module! :repository
179 with_credentials "dlopper", "foo" do
180 assert_failure "mkdir --message Creating_a_directory", svn_url(random_filename)
181 end
182 end
183
161 def test_invalid_credentials_should_fail
184 def test_invalid_credentials_should_fail
162 Project.find(1).update_attribute :is_public, false
185 Project.find(1).update_attribute :is_public, false
163 with_credentials "dlopper", "foo" do
186 with_credentials "dlopper", "foo" do
General Comments 0
You need to be logged in to leave comments. Login now