mirror of
https://github.com/redmine/redmine.git
synced 2025-11-14 01:06:00 +01:00
Merged r16286 (#24307).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@16296 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -244,6 +244,7 @@ sub RedmineDSN {
|
|||||||
WHERE
|
WHERE
|
||||||
users.login=?
|
users.login=?
|
||||||
AND projects.identifier=?
|
AND projects.identifier=?
|
||||||
|
AND EXISTS (SELECT 1 FROM enabled_modules em WHERE em.project_id = projects.id AND em.name = 'repository')
|
||||||
AND users.type='User'
|
AND users.type='User'
|
||||||
AND users.status=1
|
AND users.status=1
|
||||||
AND (
|
AND (
|
||||||
@@ -390,7 +391,9 @@ sub is_public_project {
|
|||||||
|
|
||||||
my $dbh = connect_database($r);
|
my $dbh = connect_database($r);
|
||||||
my $sth = $dbh->prepare(
|
my $sth = $dbh->prepare(
|
||||||
"SELECT is_public FROM projects WHERE projects.identifier = ? AND projects.status <> 9;"
|
"SELECT is_public FROM projects
|
||||||
|
WHERE projects.identifier = ? AND projects.status <> 9
|
||||||
|
AND EXISTS (SELECT 1 FROM enabled_modules em WHERE em.project_id = projects.id AND em.name = 'repository');"
|
||||||
);
|
);
|
||||||
|
|
||||||
$sth->execute($project_id);
|
$sth->execute($project_id);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ require File.expand_path('../test_case', __FILE__)
|
|||||||
require 'tmpdir'
|
require 'tmpdir'
|
||||||
|
|
||||||
class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase
|
class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase
|
||||||
fixtures :projects, :users, :members, :roles, :member_roles, :auth_sources
|
fixtures :projects, :users, :members, :roles, :member_roles, :auth_sources, :enabled_modules
|
||||||
|
|
||||||
SVN_BIN = Redmine::Configuration['scm_subversion_command'] || "svn"
|
SVN_BIN = Redmine::Configuration['scm_subversion_command'] || "svn"
|
||||||
|
|
||||||
@@ -38,6 +38,11 @@ class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase
|
|||||||
assert_failure "ls", svn_url
|
assert_failure "ls", svn_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_anonymous_read_on_public_project_with_module_disabled_should_fail
|
||||||
|
Project.find(1).disable_module! :repository
|
||||||
|
assert_failure "ls", svn_url
|
||||||
|
end
|
||||||
|
|
||||||
def test_anonymous_read_on_private_repo_should_fail
|
def test_anonymous_read_on_private_repo_should_fail
|
||||||
Project.find(1).update_attribute :is_public, false
|
Project.find(1).update_attribute :is_public, false
|
||||||
assert_failure "ls", svn_url
|
assert_failure "ls", svn_url
|
||||||
@@ -128,6 +133,15 @@ class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_member_read_on_private_repo_with_module_disabled_should_fail
|
||||||
|
Role.find(2).add_permission! :browse_repository
|
||||||
|
Project.find(1).update_attribute :is_public, false
|
||||||
|
Project.find(1).disable_module! :repository
|
||||||
|
with_credentials "dlopper", "foo" do
|
||||||
|
assert_failure "ls", svn_url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_member_commit_on_public_repo_with_permission_should_succeed
|
def test_member_commit_on_public_repo_with_permission_should_succeed
|
||||||
Role.find(2).add_permission! :commit_access
|
Role.find(2).add_permission! :commit_access
|
||||||
with_credentials "dlopper", "foo" do
|
with_credentials "dlopper", "foo" do
|
||||||
@@ -158,6 +172,15 @@ class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_member_commit_on_private_repo_with_module_disabled_should_fail
|
||||||
|
Role.find(2).add_permission! :commit_access
|
||||||
|
Project.find(1).update_attribute :is_public, false
|
||||||
|
Project.find(1).disable_module! :repository
|
||||||
|
with_credentials "dlopper", "foo" do
|
||||||
|
assert_failure "mkdir --message Creating_a_directory", svn_url(random_filename)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_invalid_credentials_should_fail
|
def test_invalid_credentials_should_fail
|
||||||
Project.find(1).update_attribute :is_public, false
|
Project.find(1).update_attribute :is_public, false
|
||||||
with_credentials "dlopper", "foo" do
|
with_credentials "dlopper", "foo" do
|
||||||
|
|||||||
Reference in New Issue
Block a user