@@ -244,6 +244,7 sub RedmineDSN { | |||
|
244 | 244 | WHERE |
|
245 | 245 | users.login=? |
|
246 | 246 | AND projects.identifier=? |
|
247 | AND EXISTS (SELECT 1 FROM enabled_modules em WHERE em.project_id = projects.id AND em.name = 'repository') | |
|
247 | 248 | AND users.type='User' |
|
248 | 249 | AND users.status=1 |
|
249 | 250 | AND ( |
@@ -390,7 +391,9 sub is_public_project { | |||
|
390 | 391 | |
|
391 | 392 | my $dbh = connect_database($r); |
|
392 | 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 | 399 | $sth->execute($project_id); |
@@ -19,7 +19,7 require File.expand_path('../test_case', __FILE__) | |||
|
19 | 19 | require 'tmpdir' |
|
20 | 20 | |
|
21 | 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 | 24 | SVN_BIN = Redmine::Configuration['scm_subversion_command'] || "svn" |
|
25 | 25 | |
@@ -38,6 +38,11 class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase | |||
|
38 | 38 | assert_failure "ls", svn_url |
|
39 | 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 | 46 | def test_anonymous_read_on_private_repo_should_fail |
|
42 | 47 | Project.find(1).update_attribute :is_public, false |
|
43 | 48 | assert_failure "ls", svn_url |
@@ -128,6 +133,15 class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase | |||
|
128 | 133 | end |
|
129 | 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 | 145 | def test_member_commit_on_public_repo_with_permission_should_succeed |
|
132 | 146 | Role.find(2).add_permission! :commit_access |
|
133 | 147 | with_credentials "dlopper", "foo" do |
@@ -158,6 +172,15 class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase | |||
|
158 | 172 | end |
|
159 | 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 | 184 | def test_invalid_credentials_should_fail |
|
162 | 185 | Project.find(1).update_attribute :is_public, false |
|
163 | 186 | with_credentials "dlopper", "foo" do |
General Comments 0
You need to be logged in to leave comments.
Login now