@@ -239,7 +239,7 sub RedmineDSN { | |||
|
239 | 239 | my ($self, $parms, $arg) = @_; |
|
240 | 240 | $self->{RedmineDSN} = $arg; |
|
241 | 241 | my $query = "SELECT |
|
242 | hashed_password, salt, auth_source_id, permissions | |
|
242 | users.hashed_password, users.salt, users.auth_source_id, roles.permissions, projects.status | |
|
243 | 243 | FROM projects, users, roles |
|
244 | 244 | WHERE |
|
245 | 245 | users.login=? |
@@ -381,7 +381,7 sub is_public_project { | |||
|
381 | 381 | |
|
382 | 382 | my $dbh = connect_database($r); |
|
383 | 383 | my $sth = $dbh->prepare( |
|
384 | "SELECT is_public FROM projects WHERE projects.identifier = ?;" | |
|
384 | "SELECT is_public FROM projects WHERE projects.identifier = ? AND projects.status <> 9;" | |
|
385 | 385 | ); |
|
386 | 386 | |
|
387 | 387 | $sth->execute($project_id); |
@@ -460,7 +460,10 sub is_member { | |||
|
460 | 460 | $sth->execute($redmine_user, $project_id); |
|
461 | 461 | |
|
462 | 462 | my $ret; |
|
463 | while (my ($hashed_password, $salt, $auth_source_id, $permissions) = $sth->fetchrow_array) { | |
|
463 | while (my ($hashed_password, $salt, $auth_source_id, $permissions, $project_status) = $sth->fetchrow_array) { | |
|
464 | if ($project_status eq "9" || ($project_status ne "1" && $access_mode eq "W")) { | |
|
465 | last; | |
|
466 | } | |
|
464 | 467 | |
|
465 | 468 | unless ($auth_source_id) { |
|
466 | 469 | my $method = $r->method; |
@@ -168,6 +168,49 class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase | |||
|
168 | 168 | end |
|
169 | 169 | end |
|
170 | 170 | |
|
171 | def test_read_on_archived_projects_should_fail | |
|
172 | Project.find(1).update_attribute :status, Project::STATUS_ARCHIVED | |
|
173 | assert_failure "ls", svn_url | |
|
174 | end | |
|
175 | ||
|
176 | def test_read_on_archived_private_projects_should_fail | |
|
177 | Project.find(1).update_attribute :status, Project::STATUS_ARCHIVED | |
|
178 | Project.find(1).update_attribute :is_public, false | |
|
179 | with_credentials "dlopper", "foo" do | |
|
180 | assert_failure "ls", svn_url | |
|
181 | end | |
|
182 | end | |
|
183 | ||
|
184 | def test_read_on_closed_projects_should_succeed | |
|
185 | Project.find(1).update_attribute :status, Project::STATUS_CLOSED | |
|
186 | assert_success "ls", svn_url | |
|
187 | end | |
|
188 | ||
|
189 | def test_read_on_closed_private_projects_should_succeed | |
|
190 | Project.find(1).update_attribute :status, Project::STATUS_CLOSED | |
|
191 | Project.find(1).update_attribute :is_public, false | |
|
192 | with_credentials "dlopper", "foo" do | |
|
193 | assert_success "ls", svn_url | |
|
194 | end | |
|
195 | end | |
|
196 | ||
|
197 | def test_commit_on_closed_projects_should_fail | |
|
198 | Project.find(1).update_attribute :status, Project::STATUS_CLOSED | |
|
199 | Role.find(2).add_permission! :commit_access | |
|
200 | with_credentials "dlopper", "foo" do | |
|
201 | assert_failure "mkdir --message Creating_a_directory", svn_url(random_filename) | |
|
202 | end | |
|
203 | end | |
|
204 | ||
|
205 | def test_commit_on_closed_private_projects_should_fail | |
|
206 | Project.find(1).update_attribute :status, Project::STATUS_CLOSED | |
|
207 | Project.find(1).update_attribute :is_public, false | |
|
208 | Role.find(2).add_permission! :commit_access | |
|
209 | with_credentials "dlopper", "foo" do | |
|
210 | assert_failure "mkdir --message Creating_a_directory", svn_url(random_filename) | |
|
211 | end | |
|
212 | end | |
|
213 | ||
|
171 | 214 | if ldap_configured? |
|
172 | 215 | def test_user_with_ldap_auth_source_should_authenticate_with_ldap_credentials |
|
173 | 216 | ldap_user = User.new(:mail => 'example1@redmine.org', :firstname => 'LDAP', :lastname => 'user', :auth_source_id => 1) |
General Comments 0
You need to be logged in to leave comments.
Login now